LEADTOOLS DICOM C DLL Help > Features of LEADTOOLS DICOM > DICOM Communication > Service Class User (SCU) and Service Class Provider (SCP) > Creating an SCP |
The following steps provide the basic information required to create an SCP:
Create the DICOM Network handle by calling L_DicomCreateNet.
Initialize the DICOM Network handle by calling L_DicomStartUp. This must be done before any DICOM Network Operations functions are called. Please note that this only needs to be called once for each application.
Call L_DicomSetCallback to set the callback functions you wish to use.
To listen for incoming connection requests, call L_DicomListen.
When an SCU wishes to connect to an SCP, the SCU calls L_DicomConnect. This generates a call to the ACCEPTCALLBACK function on the SCP, to let the SCP know that a connection request has been received.
The SCP should respond by calling L_DicomCreateNet, L_DicomSetCallback and L_DicomAccept. Calling L_DicomCreateNet and L_DicomSetCallback creat a network handle for this specific connection and allows the SCP to maintain information about this connection. Calling L_DicomAccept will generate a call to the CONNECTCALLBACK on the SCU. At this time the DICOM Network connection has been established. (An SCP should always accept a connection request. Once the connection is made the SCP can check the SCU and close the connection if it does not wish to maintain it. Since the connection requests are queued, if the connection is not accepted, it remains in the queue. When the next request is received, it is placed in the queue behind the first request. Calling L_DicomAccept at this point will connect the first request, not the second, since the first request is still in the queue.)
Establish a security layer. For more information on security layers, refer to Adding Security to a DICOM Connection and Adding TLS Security to a DICOM Connection.
When an SCU requests a DICOM Associate connection, the SCU calls L_DicomSendAssociateRequest. This generates a call to RECEIVEASSOCIATEREQUESTCALLBACK on the SCP.
When the RECEIVEASSOCIATEREQUESTCALLBACK function is called, create the DICOM Associate handle by calling L_DicomCreateAssociate.
Reset the newly created DICOM Associate handle to an Associate Accept by calling L_DicomResetAssociate, or set the new DICOM Associate handle using the following functions:
The DICOM Associate connection request can be accepted or rejected.
To accept the Associate connection request, call L_DicomSendAssociateAccept. This will generate a call to the RECEIVEASSOCIATEACCEPTCALLBACK on the SCU. At this time the DICOM Associate connection has been established.
To reject the Associate connection request, call L_DicomSendAssociateReject. This will generate a call to the RECEIVEASSOCIATEREJECTCALLBACK function on the SCU.