LEADTOOLS DICOM C++ Class Library Help > LEADTOOLS DICOM Features > DICOM Communication > DICOM Network Connections > Creating a DICOM Network Connection |
Available in LEADTOOLS Medical Imaging toolkits. |
When establishing a connection between two AEs, for the purpose of transferring DICOM data and messages, the first step is to create a DICOM Network connection.
The AE acting as an SCP must have a DICOM Network object and the AE acting as an SCU must have a DICOM Network object. In addition, every time an SCP accepts a new connection request from an SCU, the SCP creates another DICOM Network object for the newly connected SCU. This provides the SCP with memory for maintaining information about the SCU and that particular connection. Steps for establishing a DICOM Network connection are given below for both the SCU and the SCP.
Creating a network handle for an SCU
Initialize the DICOM DLL by calling LDicomNet::StartUp. 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.
Create the DICOM Network handle by calling LDicomNet::LDicomNet.
To connect to an SCP, call LDicomNet::Connect. This will generate a call to the LDicomNet::OnAccept function on the SCP to let the SCP know that a connection request has been received.
The SCP should respond by calling LDicomNet::Accept. This will generate a call to the LDicomNet::OnConnect on the SCU. At this time the DICOM Network connection has been established.
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
Creating a network handle for an SCP
Initialize the DICOM DLL by calling LDicomNet::StartUp. 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.
Create the DICOM Network object by calling LDicomNet::LDicomNet.
To listen for incoming connection requests, call LDicomNet::Listen.
When an SCU wishes to connect to an SCP, the SCU calls LDicomNet::Connect. This generates a call to the LDicomNet::OnAccept function on the SCP to let the SCP know that a connection request has been received.
The SCP should respond by calling LDicomNet::LDicomNet and LDicomNet::Accept. Calling LDicomNet::LDicomNet and create a network object for this specific connection and allows the SCP to maintain information about this connection. Calling LDicomNet::Accept will generate a call to the LDicomNet::OnConnect 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 LDicomNet::Accept 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.
For more information on creating SCUs and SCPs, refer to Creating an SCU or Creating an SCP.
Once the DICOM Network Connection has been made, you must create a DICOM Associate Connection before DICOM messages and data can be transferred between the AEs. For more information in creating a DICOM Associate connection, refer to Creating a DICOM Associate Connection.