|
Boost Users : |
Subject: [Boost-users] [getting IP-header]How do I get the IP-header information
From: Mats Carlsson (m.mcaber_at_[hidden])
Date: 2009-10-29 11:10:58
Hello,
I'm trying to get the IP-header information from an IP-message sent
using boost. I can get the message itself by using:
void Receiver::wait_for_packet() {
socket.async_receive_from(boost::asio::buffer(receive_buffer),
remote_endpoint, boost::bind(
&Receiver::handle_packet, this, boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
}
void Receiver::handle_packet(const boost::system::error_code& error,
int bytes_transferred) {
if (error) {
//throw boost::system::system_error(error);
}
std::string message;
for (int i = 0; i < bytes_transferred; i++) {
message += receive_buffer[i];
}
std::string payload(message);
Packet packet;
packet.set_payload(payload);
listener->new_packet_received(packet);
wait_for_packet();
}
Where "message" is the body of the sent stuff. But how do I get to the
IP-header things?
I've been looking in
doc/html/boost_asio/example/serialization/connection.hpp, but do not
really get what to do.
BR,
/Mats Carlsson
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