|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Bind to first available portI know how to do this with Windows sockets, but how do I bind a UDP listen socket to the first available port? I want to send a packet from client to the server to subscribe to data and tell the server what port to send the subscribed data to. I don't care what port the client listens to. If I hard code it, I can only run a single client on a PC. I want to bind to the first available one so I can run as many clients on the same PC as I want.
_______________________________________________ Boost-users mailing list Boost-users@... http://lists.boost.org/mailman/listinfo.cgi/boost-users |
|
|
Re: Bind to first available portMathew Benson wrote: > I know how to do this with Windows sockets, but how do I bind a UDP listen > socket to the first available port? I want to send a packet from client > to the server to subscribe to data and tell the server what port to send > the > subscribed data to. I don't care what port the client listens to. If I > hard code it, I can only run a single client on a PC. I want to bind to > the first available one so I can run as many clients on the same PC as I > want. AFAIK, just bind to port 0 and you will get assigned a random port. Cheers, Rutger _______________________________________________ Boost-users mailing list Boost-users@... http://lists.boost.org/mailman/listinfo.cgi/boost-users |
|
|
Re: Bind to first available portOh. That makes sense. I think that's how the native socket call is.
Thanks. Sent from my iPhone On Oct 30, 2009, at 12:35 PM, Rutger ter Borg <rutger@...> wrote: > > Mathew Benson wrote: > >> I know how to do this with Windows sockets, but how do I bind a UDP >> listen >> socket to the first available port? I want to send a packet from >> client >> to the server to subscribe to data and tell the server what port to >> send >> the >> subscribed data to. I don't care what port the client listens to. >> If I >> hard code it, I can only run a single client on a PC. I want to >> bind to >> the first available one so I can run as many clients on the same PC >> as I >> want. > > AFAIK, just bind to port 0 and you will get assigned a random port. > > Cheers, > > Rutger > > > > _______________________________________________ > Boost-users mailing list > Boost-users@... > http://lists.boost.org/mailman/listinfo.cgi/boost-users Boost-users mailing list Boost-users@... http://lists.boost.org/mailman/listinfo.cgi/boost-users |
|
|
Re: Bind to first available portHow do I read out what port was assigned?
On Fri, Oct 30, 2009 at 1:26 PM, Mathew Benson <mathew.benson@...> wrote: Oh. That makes sense. I think that's how the native socket call is. Thanks. _______________________________________________ Boost-users mailing list Boost-users@... http://lists.boost.org/mailman/listinfo.cgi/boost-users |
|
|
Re: Bind to first available portMathew Benson wrote: > > How do I read out what port was assigned? > By using socket.local_endpoint.port() Cheers, Rutger _______________________________________________ Boost-users mailing list Boost-users@... http://lists.boost.org/mailman/listinfo.cgi/boost-users |
| Free embeddable forum powered by Nabble | Forum Help |