id summary reporter owner description type status milestone component version severity resolution keywords cc 4787 ASIO - adding support for accessing UDP control headers anonymous chris_kohlhoff "Attached patch implements ASIO support for accessing optional UDP control headers such as the timestamp information set with SO_TIMESTAMP. Here are two ways of getting timestamp information using the new feature of the patch. Note that it works in synchronous and asynchronous mode. ip::udp::socket sock; ... sock.set_option(ip::unicast::timestamp(true)); ... ip::udp::endpoint ep; sock.receive_from(buf, ep, bytes_transferred); boost::asio::detail::io_control::siocgstamp tv1; for (const cmsghdr* cmsg = ep.control_header_first(); cmsg; cmsg = ep.control_header_next(cmsg)) { printf("" cmsg_len %zu: "", cmsg->cmsg_len); switch (cmsg->cmsg_level) { case SOL_SOCKET: switch (cmsg->cmsg_type) { case SO_TIMESTAMP: { const timeval *stamp = ep.control_msg_data(cmsg); printf(""SO_TIMESTAMP %ld.%06ld"", (long)stamp->tv_sec, (long)stamp->tv_usec); tv1.set(*stamp); break; } case SO_TIMESTAMPNS: { const timespec* stamp = ep.control_msg_data(cmsg); ... break; } default: printf(""type %d"", cmsg->cmsg_type); break; } break; } default: printf(""Level %d, Type %d"", cmsg->cmsg_level, cmsg->cmsg_type); break; } } // Alternative way of getting the last datagram's kernel timestamp boost::asio::detail::io_control::siocgstamp tv; boost::system::error_code ec; boost::asio::detail::socket_ops::state_type client_state = 0; boost::asio::detail::socket_ops::ioctl( a_sock.native(), client_state, tv.name(), tv.data(), ec); Hope it can be included in the release. Regards, Serge" Patches new To Be Determined asio Boost 1.44.0 Problem saleyn@… leon@…