|
Boost Users : |
From: Igor R (boost.lists_at_[hidden])
Date: 2008-07-25 13:20:38
> I guess this means the socket itself is invalid but if i put the local end
> point into the constructor for the socket_ as below it works fine.
>
> socket_(io_service, udp::endpoint( udp::v4(), port ) )
According to the ASIO reference:
http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/reference/basic_datagram_socket/basic_datagram_socket/overload3.html
"This constructor creates a datagram socket and automatically opens it
bound to the specified endpoint on the local machine. "
In your example, the socket was created but it's not "open" yet, (so
it doesn't have a valid handle). So before you bind() it, you have to
open() it:
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