tags:

views:

198

answers:

4

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?

+1  A: 

For Windows:

http://msdn.microsoft.com/en-us/library/ms738556(VS.85).aspx

For *nix:

http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/apis/htonl.htm

A quick search did not provide anything resonable in boost.
Hopefuuly somebody else will find somthing.

Martin York
thanks very much. That is what I thought.
MeThinks
+1  A: 

POSIX.1-2001 standard is <sys/types.h> & <netinet/in.h>, on Windows you have 2 stacks to choose from <winsock2.h> or <ws2tcpip.h> & <winsock2.h>, the latter is now the preferred choice as it supports Unicode naming but note that they are incompatible.

Platforms pre-2001 might require other headers such as <arpa/inet.h>.

Steve-o
Cheers. This will help.
MeThinks
+1  A: 

boost::asio::detail::socket_ops::host_to_network_short in boost/asio/detail/socket_ops.hpp

syffinx
+1  A: 

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.

MeThinks