Posted By


jx_boi on 08/30/10

Tagged


Statistics


Viewed 139 times
Favorited by 3 user(s)

GetAvailablePort


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. public static int GetAvailablePort()
  2. {
  3. TcpListener list = new TcpListener(0);
  4. list.Start();
  5. int port = (list.LocalEndpoint as IPEndPoint).Port;
  6. list.Stop();
  7. return port;
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.