1

I am facing a strange issue where my UDP socket that was earlier bound to a port is not unbinding from the port when I call closesocket(). The API call doesn't return any error but netstat command and TCPView app still show that port is still in use by my application.

My application is a COM server and socket creation happens on one thread, binding closing happens on different thread, reading on a third thread.

So far tried creating the socket, binding, reading and closing on the same thread but still seeing the issue.

1
  • 1
    I found out the issue. After creating and binding the UDP socket, I was calling CreateProcess() with inherit handle parameter to true. So when closing the socket, Windows was still not unbinding the port. After changing the inherit parameter to false, everything works perfectly. Commented Mar 24, 2022 at 10:31

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.