-
January 8th, 2009, 09:07 AM
#1
Finding an avialable TCP Port
Could someone point me to some sample C++ code that finds an available port on the local machine?
-
January 8th, 2009, 09:48 AM
#2
Re: Finding an avialable TCP Port
It depends on the operating system.
In UNIX for example you can use port 0 to allow your OS to automatically find and return the next available port. (In the dynamic port range).
Hope it helps
Doron Moraz
-
January 8th, 2009, 09:59 AM
#3
Re: Finding an avialable TCP Port
I think your looking for a port scanner. This link looked interesting!
http://www.planet-source-code.com/vb...=8010&lngWId=3
Try googling for port scanner c++ and code.
ahoodin
To keep the plot moving, that's why.
-
January 8th, 2009, 10:48 AM
#4
Re: Finding an avialable TCP Port
Originally Posted by Doron Moraz
In UNIX for example you can use port 0 to allow your OS to automatically find and return the next available port. (In the dynamic port range).
The same is also in Windows.
Victor Nijegorodov
-
January 10th, 2009, 06:52 PM
#5
Re: Finding an avialable TCP Port
Thank you all! Yes, binding to port 0 works just fine - I am doing this for win32 and win64 platforms... I wasnt familiar with socket programming at all, but still didnt take long to get this piece done. Thanks a lot!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|