www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Bind to any port and get it after binding.

reply Dawid =?ISO-8859-2?Q?Ci=EA=BFarkiewicz?= <arael fov.pl> writes:
I pass InternetAddress.PORT_ANY to Socket.bind. How can I figure out on
which port socket is listening.
-- 
Dawid Ciężarkiewicz | arael
Jun 23 2005
parent "Regan Heath" <regan netwin.co.nz> writes:
On Thu, 23 Jun 2005 23:41:59 +0200, Dawid Ciężarkiewicz <arael fov.pl>  
wrote:
 I pass InternetAddress.PORT_ANY to Socket.bind. How can I figure out on
 which port socket is listening.

Try the "localAddress()" method, it returns an Address (or rather an InternetAddress) which has a "port()" method. Regan
Jun 23 2005