[asio-users] asio::async_read with a udp::socket?
Brought to you by:
chris_kohlhoff
|
From: <da...@ty...> - 2007-03-15 11:26:44
|
Hi,
This might be a dumb question :)
I'm trying to change the serialization sample code found among the
examples to work on UDP sockets instead of TCP sockets. As a first shot,
I simply replaced the tcp::socket types everywhere with udp::socket
types. And now I get the following compilation error:
connection.hxx:67: instantiated from ‘void
s11n_example::connection::async_read(T&, Handler) [with T =
std::vector<s11n_example::stock, std::allocator<s11n_example::stock> >,
Handler = boost::_bi::bind_t<void, boost::_mfi::mf1<void,
s11n_example::client, const asio::error&>,
boost::_bi::list2<boost::_bi::value<s11n_example::client*>,
boost::arg<1> > >]’
client.cxx:41: instantiated from here
/usr/include/asio/impl/read.ipp:174: error: ‘class
asio::basic_datagram_socket<asio::ip::udp,
asio::datagram_socket_service<asio::ip::udp> >’ has no member named
‘async_read_some’
make: *** [client.o] Error 1
The line in question that give the error message:
asio::async_read(socket_, asio::buffer(inbound_header_),
boost::bind(f,
this, asio::placeholders::error, boost::ref(t),
boost::make_tuple(handler)));
what would be the proper way to call asio::async_read with a UDP socket?
Akos
PS: my ultimate goal is to serialize objects using a multicast socket -
a server casts the serialized data, and multiple clients pick it up.
|