Windows port is not immediately released after ASC_dropNetwork

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
ErWu
Posts: 6
Joined: Tue, 2019-11-12, 09:15

Windows port is not immediately released after ASC_dropNetwork

#1 Post by ErWu »

Hello, in our application, we've implemented a restart functionality for a Store SCP. The SCP is halted, concluding with a call to ASC_dropNetwork. When we attempt to restart the SCP using ASC_initializeNetwork, we encounter the message "cannot create network: port already in use." A sleep of 20 seconds between these two calls resolves the issue, allowing it to function as expected.

We observe this behavior only on Windows, not on Linux.

Does anybody else observes this? Is this a normal behavior or do we miss something?

Greetings
Eric

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Windows port is not immediately released after ASC_dropNetwork

#2 Post by Marco Eichelberg »

By default, in all operating systems a closed listen socket will be kept in the TIME_WAIT state by the operating system for some time, in order to "catch" packets that were sent to that socket and have not yet arrived.
On Posix systems (such as Linux), DCMTK explicitly disables this delay by setting the SO_REUSEADDR socket option. On Windows, this option has a different meaning, and DCMTK instead sets SO_EXCLUSIVEADDRUSE. You might want to try and set both SO_REUSEADDR and SO_EXCLUSIVEADDRUSE and see if this helps. Search for "SO_EXCLUSIVEADDRUSE" in dcmnet/libsrc/dul.cc.

ErWu
Posts: 6
Joined: Tue, 2019-11-12, 09:15

Re: Windows port is not immediately released after ASC_dropNetwork

#3 Post by ErWu »

Thank you for that suggestion. I will try that and give you a feedback soon.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest