LEADTOOLS DICOM C++ Class Library Help > LEADTOOLS DICOM Features > 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 LDicomAssociate::LDicomAssociate.
Initialize the newly created DICOM Associate handle by calling LDicomAssociate::Default, or set the new DICOM Associate handle using the following functions:
LDicomAssociate::SetApplication
LDicomAssociate::SetPresentation
LDicomAssociate::SetImplementClass
LDicomAssociate::SetAsyncOperations
LDicomAssociate::SetRoleSelect
LDicomAssociate::SetImplementVersion
LDicomAssociate::AddPresentation
To connect to an SCP, call LDicomNet::SendAssociateRequest. This will generate a call to the LDicomNet::OnReceiveAssociateRequest 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 LDicomNet::SendAssociateAccept or LDicomNet::SendAssociateReject. This will generate a call to the LDicomNet::OnReceiveAssociateAccept or the LDicomNet::OnReceiveAssociateReject. If LDicomNet::OnReceiveAssociateAccept 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 LDicomNet::SendAssociateRequest. This generates a call to LDicomNet::OnReceiveAssociateRequest on the SCP.
When the LDicomNet::OnReceiveAssociateRequest function is called, create the DICOM Associate handle by calling LDicomAssociate::LDicomAssociate.
Reset the newly created DICOM Associate handle to an Associate Accept by calling LDicomAssociate::Reset, 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 LDicomNet::SendAssociateAccept. This will generate a call to the LDicomNet::OnReceiveAssociateAccept on the SCU. At this time the DICOM Associate connection has been established. To reject the Associate connection request, call LDicomNet::SendAssociateReject. This will generate a call to the LDicomNet::OnReceiveAssociateReject function on the SCU.