LEADTOOLS DICOM C DLL Help > Features of LEADTOOLS DICOM > DICOM Communication > DICOM Associate Connections > Creating a DICOM Associate Connection |
Once a DICOM Network Connection has been established, a DICOM Associate Connection must be established before DICOM messages and data can be transferred between two AEs.
The AE acting as an SCP must have a DICOM Associate handle and the AE acting as an SCU must have a DICOM Associate handle. Steps for establishing a DICOM Associate connection are given below for both the SCU and the SCP.
Creating an associate handle for an SCU
Create the DICOM Associate handle by calling L_DicomCreateAssociate.
Initialize the newly created DICOM Associate handle by calling L_DicomDefaultAssociate, or set the new DICOM Associate handle using the following functions:
To connect to an SCP, call L_DicomSendAssociateRequest. This will generate a call to the RECEIVEASSOCIATEREQUESTCALLBACK on the SCP to let the SCP know an associate connection request has been received.
The SCP may accept or reject the request and respond by calling L_DicomSendAssociateAccept or L_DicomSendAssociateReject. This will generate a call to the RECEIVEASSOCIATEACCEPTCALLBACK or the RECEIVEASSOCIATEREJECTCALLBACK. If RECEIVEASSOCIATEACCEPTCALLBACK is called, the DICOM Associate Connection has been established.
Creating an associate handle for an SCP
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 functions given above.
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.
Freeing allocated memory
When the DICOM Associate handle is no longer needed, call L_DicomFreeAssociate to free the memory allocated for the specified DICOM Associate.