/bundles/itninjaweb/img/Breadcrumb_cap_w.png
Hi every one.. m using .net frame work.. can ny one tell me that is there ny method to find out an unused port number in the system...
actully i need to select a port number which is free so that my sever socket can listen on that..
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

0
Don't have a general solution for you but the command "netstat" will show running services and connected ports. You can also have a look at the services file located under C:\WINDOWS\system32\drivers\etc.
Answered 11/24/2006 by: AngelD
Red Belt

Please log in to comment
0
Hi, it looks like there is a method to manipulate ports in .NET.
http://msdn2.microsoft.com/en-us/library/system.servicemodel.netpeertcpbinding.port.aspx
There should be a way to enumerate used and free ports with this method. Have a look at the newsgroups.

Hope this helps.
Answered 11/27/2006 by: aogilmor
Ninth Degree Black Belt

Please log in to comment