[muscle] Re: Server

  • From: Jeremy Friesner <jaf@xxxxxxxxxxxx>
  • To: muscle@xxxxxxxxxxxxx
  • Date: Thu, 13 Jan 2005 09:52:27 -0800

Hi Julien,

You can get the server to dynamically allocate a port to listen on
by passing in zero as the port number argument to PutAcceptFactory()
or CreateAcceptingSocket().  Note that if you want to do this with
muscled, you'll need to change line 82 of muscled.cpp to read:

         if (port >=3D 0) ports.AddTail(port);

As far as finding out what port was allocated, if you are calling
CreateAcceptingSocket(), you can set the third argument (optRetPort)
and the port that was allocated will be written into the uint16
that optRetPort points to. =20

If you are calling PutAcceptFactory(), then you can call GetPort() on your=
ReflectSessionFactory object after the call to PutAcceptFactory() succeeded=
to find out which port the factory is bound to.


On Thursday 13 January 2005 07:26, Julien Torr=E8s wrote:
> We would like to launch several servers on the same machine. Thus, we=3D20
> need several ports (one per server). So is it possible to run a server,=
> and this server will dynamically allocate a port? Then what is the=3D20
> function to get the port allocated by the server?

Other related posts: