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
Windows port is not immediately released after ASC_dropNetwork
Moderator: Moderator Team
-
- OFFIS DICOM Team
- Posts: 1446
- Joined: Tue, 2004-11-02, 17:22
- Location: Oldenburg, Germany
- Contact:
Re: Windows port is not immediately released after ASC_dropNetwork
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.
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.
Re: Windows port is not immediately released after ASC_dropNetwork
Thank you for that suggestion. I will try that and give you a feedback soon.
Who is online
Users browsing this forum: Amazon [Bot], Baidu [Spider], Bing [Bot], Semrush [Bot] and 1 guest