|
Boost Users : |
From: Brian T Crowder (crowder_at_[hidden])
Date: 2008-07-25 15:37:13
-----Original Message-----
From: Igor R <boost.lists_at_[hidden]>
Sent: Friday, July 25, 2008 10:20 AM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Asio - Errors (Igor R)
> 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:
http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/reference/basic_datagram_socket/bind/overload1.html
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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