| LEADTOOLS DICOM C DLL Help > Function References > L_DicomSendNSetRequest | 
#include "ltdic.h"
L_LTDIC_API L_INT L_DicomSendNSetRequest(hNet, nPresentationID, nMessageID, pszClass, pszInstance, hDS)
| HDICOMNET hNet; | /* a DICOM Network handle */ | 
| L_UCHAR nPresentationID; | /* presentation ID */ | 
| L_UINT16 nMessageID; | /* message ID */ | 
| L_TCHAR * pszClass; | /* class type */ | 
| L_TCHAR * pszInstance; | /* instance */ | 
| HDICOMDS hDS; | /* data set */ | 
Sends an N-SET-REQ message to a peer member of a connection. This function is available in the PACS Imaging.
| Parameter | Description | 
| hNet | A DICOM Network handle to the peer member of the connection. | 
| nPresentationID | Presentation ID. The presentation ID provides information about both the class type of the data and the transfer syntax to use when transferring the data. | 
| nMessageID | Message ID. Each message sent by a member of a connection should have a unique ID. Since a member of a connection may send several messages, this ID allows that member to identify when a specific request has been completed. | 
| pszClass | Class affected by the request. This will be an SOP Class or an SOP MetaClass. | 
| pszInstance | The instance of the class. A server may, for example, have three instances of the Nuclear Medicine Class. This value identifies the data with a specific instance. | 
| hDS | Data set that contains the new information to set. | 
Returns
| DICOM_SUCCESS | The function was successful. | 
| >0 | An error occurred. Refer to Return Codes. | 
Comments
Calling this function generates a call to RECEIVENSETREQUESTCALLBACK on the SCP. The SCP should respond by calling L_DicomSendNSetResponse which will generate a call to RECEIVENSETRESPONSECALLBACK.
Required DLLs and Libraries
| For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application | 
Platforms
Win32, x64, Linux.
See Also
| Functions: | L_DicomSendNSetResponse, RECEIVENSETREQUESTCALLBACK, RECEIVENSETRESPONSECALLBACK | 
| Topics: | 
Example
L_INT DicomSendNSetRequestExample(HDICOMNET hNet)
{
   L_TCHAR szClassUID[200];
   L_TCHAR szInstance[200];
   L_TCHAR szMsg[200];
   HDICOMPDU hPDU;
   L_UCHAR nID;
   L_TCHAR szNewID[200];
   HDICOMDS hDS=NULL;
   pDICOMTAG pTag=NULL;
   pDICOMELEMENT pElement=NULL;
   L_INT nRet;
   
   /* this sample allows you to change the patient id of an SOP Instance */
   
   /* send an N-GET-REQUEST to the server */
   
   /* this sample uses fixed values */
   lstrcpy(szClassUID, UID_SC_IMAGE_STORAGE);
   
   lstrcpy(szInstance, TEXT("998.998.1.19950214.94000.1.102"));
   
   /* new patient id */
   lstrcpy(szNewID, TEXT("123-45-6789"));
   
   /* create the data set that encodes the changed element(s) */
   hDS = L_DicomCreateDS(NULL);
   L_DicomInitDS(hDS, CLASS_UNKNOWN, 0);
   L_DicomResetDS(hDS);
   
   pTag = L_DicomFindTag(TAG_PATIENT_ID);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_ID, pTag->nVR, FALSE, 0);
   if (pElement == NULL)
   {
      L_DicomFreeDS(hDS);
      return DICOM_ERROR_MEMORY;
   }
   L_DicomSetStringValue(hDS, pElement, szNewID, 1, DICOM_CHARACTER_SET_DEFAULT);
   
   hPDU = L_DicomGetAssociate(hNet);
   
   /* now, send a request */
   nID = L_DicomFindAbstract(hPDU, szClassUID);
   if(nID == 0)
   {
      wsprintf(szMsg, TEXT("Abstract Syntax %s Not Supported by Association!"), szClassUID);
      MessageBox(NULL, szMsg, TEXT("Error"), MB_OK);
   }
   else
   {
      nRet = L_DicomSendNSetRequest(hNet, nID, 1, szClassUID, szInstance, hDS);
      if (nRet != DICOM_SUCCESS)
      {
         L_DicomFreeDS(hDS);
         return nRet;
      }
   }
   L_DicomFreeDS(hDS);
   return DICOM_SUCCESS;
}