Boost logo

Boost Users :

Subject: [Boost-users] asio UDP local port binding issue on Windows
From: akos_at_[hidden]
Date: 2010-01-30 07:44:56


Hi,

I seem to encounter an issue when using boost asio. I'm trying to create a
UDP client-server environment, where for the client I'm creating an asio
socket like this:

io_service _io_service;
ip::udp::socket _socket(_io_service, ip::udp::v4());

my expectation at this point is that the _socket is created, and it can
send and receive UDP packets. this includes receiving packets, which also
means that the socket is bound to some random port on the local network
interface.

now this is all true on Linux and MacOS, but on Windows, the socket does
not seem to bind to a port. interestingly, for _socket.is_open() I get true
in return. but for _socket.local_endpoint(), I get an error excaption with
the error code 10022, which is defined as WSAEINVAL.

I also tried the following, and got the same results:

io_service _io_service;
ip::udp::socket _socket(_io_service);

_socket.open(ip::udp::v4());

is my assumption that the above should result in a socket bound to a local
random port incorrect?

Akos


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