MyDcmSCP m_scp;
// add transfer syntaxes and presentation contexts
// ....
// here port and AETitle are hardcoded for this example
// the real program uses the arguments passed from command line.
m_scp.setPort(104);
m_scp.setAETitle("PACSSERVER");
char * lStr = "c:\\server\\dicomscp.exe PACSSERVER 104";
if(m_scp.enableMultiProcessMode(2, &lStr) == EC_Normal)
{
COUT << "Ok" << OFendl;
}
m_scp.listen();
P.S.: my class has an handleIncomingCommand handler implemented, and tested in single mode, it works ok.
Yes, I also passed m_scp.enableMultiProcess(argc, argv) to create a process with exactly the original parameters, and the new process is created, but it doesn't handle the association.
I personally never tried the multi-process mode of the (still experimental) DcmSCP class under Windows, but as far as I can see, you need to call the following DcmSCP method in the child process (before any network initializiation):
/** Marks this SCP as being a forked child under Windows, i.e. it handles an association
* received by the parent.
* @return EC_Normal if marking was successful, an error code otherwise
*/
OFCondition markAsForkedChild();
Now, after the association is requested, the child process receives the string "--forked-child" as argv[1], knowing this, I call m_scp.markAsForkedChild(), hoping it to return EC_Normal, but it doesn't. Then, the SCU keeps waiting for the association response.
DcmSCP::markAsForkedChild() checks whether the DcmSCP class is in multi-process mode, so you should call this method after enableMultiProcessMode(). Whether this really makes sense is another story, but this is how it is currently implemented. I've added this issue to the to-do list ...
Tagging along this thread, I'm trying to subclass DcmSCP and because all its attributes are private, it makes it difficult to try overriding any protocol (like waitForAssociation).
For now I'll change the DcmSCP class to make protected the attributes I need, I think you need to adjust your code as well.
that is exactly the idea of the current API: Do _not_ use the private data elements. Use the public and protected methods and overwrite them as necessary in your own derived class. If this is not possible tell me why -- then I have to adapt non-private part of the DcmSCP API.