Boost logo

Boost Users :

Subject: [Boost-users] [asio] Setting UDP Source Port
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-04-03 00:22:38


I'm writing an application that makes use of the source port in the
UDP header. The only way I've found that sets it is by setting the
endpoint on construction of the udp::socket. The problem with that,
however, is that I have 3 different components that want to use that
port, one listening and two sending. Understandably, I cannot bind
the same port for all three. (Incidentally, while binding with the
udp::socket constructor works, the bind call gives a bad file
descriptor exception. I'm using 1.35, though, so that may have been
fixed.)

Is there some way to set the source port without binding? Since
there's no session state, it seems like I should be able to send
packets from any number of sockets. (I can't just share a socket, as
they're not shared-objects thread-safe, according to the
documentation.)

Thanks,
~ Scott McMurray


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net