I am using UDP in particular boost::asio::ip::udp::socket sockets if that helps?
What is the header file?
What headers/classes do I need to handle network byte ordering with the UDP under boost?
The htonl() function converts the unsigned integer hostlong from host byte order to network byte order. The htons() function converts the unsigned short integer hostshort from host byte order to network byte order. The ntohl() function converts the unsigned integer netlong from network byte order to host byte order.
The htonl function takes a 32-bit number in host byte order and returns a 32-bit number in the network byte order used in TCP/IP networks (the AF_INET or AF_INET6 address family). The htonl function can be used to convert an IPv4 address in host byte order to the IPv4 address in network byte order.
The ntohl function takes a 32-bit number in TCP/IP network byte order (the AF_INET or AF_INET6 address family) and returns a 32-bit number in host byte order. The ntohl function can be used to convert an IPv4 address in network byte order to the IPv4 address in host byte order.
Just found it is enough to #include <boost/asio.hpp>
as this pulls in all the platform dependent headers and gives access to htonl/ntohl
which is exactly what I need.
Thanks all for the suggestions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With