Re: Available port on localhost

Giganews Newsgroups
Subject: Re: Available port on localhost
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Tue, 2 Nov 2004

"SD" <nospa…@please.it> wrote in message
news:DC0419F6A1B2E240nospa…@please.it...

> I need to use a different port for any version and type
> of running program so I need a way to obtain the free
> port list on the localhost. How can I obtain that ?

There is no such list.  Why do you need it, though?  When you open a new
socket, just specify 0 as the Port and the underlying socket library will
automatically assign a random port for you.  Then you just query the Port
property after the socket is active in order to know which Port was actually
assigned, and then connect to it normally as needed.

Gambit

Replies

In response to

Available port on localhost posted by SD on Tue, 2 Nov 2004