Reputation: 23
i wanted to ask, if there is a possibility to receive from boost::asio::ip::udp::socket the data directly into a struct like in standard BSD Sockets:
struct T;
size = recv(sock,&T,sizeof(T));
Since i receive a lot of fixed size data,, i really do not want to copy the data into a buffer first and from there into a struct. If this is not easy achievable i will stick to standard BSD sockets again. The Struct is serializable, and that problem should not be a Concern at this moment.
Upvotes: 0
Views: 282
Reputation: 30860
Reading the documentation:
socket.receive(boost::asio::buffer((void *)&T, sizeof(T)));
Upvotes: 1