In my application I need to process images by retrieving them from a PACS server, and for that purpose I need to use a C-FIND to find the images, and then a C-MOVE to the same machine to retrieve them.
For performing the C-MOVE request I'm using a DcmSCU object, similar to the example in https://support.dcmtk.org/redmine/proje ... wto_DcmSCU; however, as the link specifies, "a separate Storage SCP like storescp is needed which actually receives the study images".
But when I tried to add a DcmStorageSCP object for the reception, I faced a chicken-and-egg situation: DcmSCU's
sendMOVERequest()
sends the request and it doesn't return until the PACS has attempted to establish communication with the destination SCP (which would also be my application). Similarly, the listen()
method in DcmSCP either blocks indefinitely, or blocks until the specified timeout has passed and then shuts down the listening socket before returning, Since both calls are blocking, I'm unable to do what I need, which is to start listening, send the request, handle the transfer, handle the response to the request and stop listening.I've moved the DcmStorageSCP object's listen call to a separate thread, and that works, but it has reliability problems. It looks like the DcmStorageSCP class is designed for a limited range of applications that doesn't include this kind of usage.
So I wanted to ask:
1. How would I go about implementing a system that is able to start listening only just before requesting a C-MOVE, making sure it is actually listening first, and stop listening when the transfer has either succeeded, failed or timed out?
2. Is it possible to satisfy the requirements in question 1 using the same thread for both SCU and SCP?
I'm using version 3.6.5 if that matters.