in reply to Re^3: What's the best way to find an unused TCP port on the local system
in thread What's the best way to find an unused TCP port on the local system

It must be a feature only of Unix(-like) systems, then. I'm working in a Windows XP environment and just tried it out with our c++ server and instead of picking a random port it actually connected to port number 0.

Updated: No, it works as described in the previous post. Our server is just reporting (incorrectly) that it is connected to port 0.

--DrWhy

"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."

  • Comment on Re^4: What's the best way to find an unused TCP port on the local system

Replies are listed 'Best First'.
Re^5: What's the best way to find an unused TCP port on the local system (XP)
by tye (Sage) on Oct 20, 2006 at 21:51 UTC

    No, it works on Windows XP as well. bind() is what typically assigns the port number. But this has become quite off topic. There are lots of choices for networking APIs to use in Windows XP from C++, so you should probably consult the documentation for whichever one you are using.

    - tye