• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to find out which ports r being used on my comp and which are free  RSS feed

 
rajat chandra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to create a server and client both on my comp . how to find out which ports r being used on my comp and which are free ???
 
Martin Simons
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the most part, any port over 10000 is almost guaranteed to be free.

If you really want to see which ports that a server process can actually
bind/listen to then, on unix, you can use the following:

netstat -an | grep -i listen

If you are using windows, I do not know.

If you mean that your server will use a range of ports and you want the
client to try and figure out which one is not in use, I can only say that
it needs to try them, one after the other.
 
Martin Simons
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The netstat command will tell you which ones are already used. Any not
listed in the output are free.
 
rajat chandra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Martin . Got it working!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!