free port number

free port number

Post by José Achi » Wed, 28 May 2003 22:12:10



Hi

What I can do if the port number is already busy? Is there a way to know if
the port is busy? In .net remoting is there a way to get a free port number
in the server and talk the client what is this port to establish the
connection?

Thanks.

 
 
 

free port number

Post by Kristopher Johnso » Wed, 28 May 2003 23:13:26


If you specify a port number of "0" to the channel constructor, then it will
allocate an unused port.  How you transfer this information to the client is
something you'll have to figure out yourself; you could write it to a file,
or into some sort of directory service.

-- Kris


Quote:> Hi

> What I can do if the port number is already busy? Is there a way to know
if
> the port is busy? In .net remoting is there a way to get a free port
number
> in the server and talk the client what is this port to establish the
> connection?

> Thanks.


 
 
 

free port number

Post by William Stace » Thu, 29 May 2003 01:48:21


You could use an ephemeral port, but your back to the same problem.  You
would need another service listening on a known port so the clients could
query that "port" and get the dynamic port used for further communication.
You can pick any port you like, but you need a way to communicate that back
to the clients.  If you have a lot of clients, this could become
impracticle.  Best bet is to pick a port that is free on your servers and
use that or use web services (IIS) on port 80.  You could use web services
to return the dynamic port to the client, but that requires a bit more work
which may or may not be worth the cost.


Quote:> Hi

> What I can do if the port number is already busy? Is there a way to know
if
> the port is busy? In .net remoting is there a way to get a free port
number
> in the server and talk the client what is this port to establish the
> connection?

> Thanks.