Re: Available port on localhost

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

"SD" <nospa…> wrote in message

> 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.



In response to

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