View mode: basic / threaded / horizontal-split · Log in · Help
June 23, 2005
Bind to any port and get it after binding.
I pass InternetAddress.PORT_ANY to Socket.bind. How can I figure out on
which port socket is listening.
-- 
Dawid Ciężarkiewicz | arael
June 23, 2005
Re: Bind to any port and get it after binding.
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
Top | Discussion index | About this forum | D home