Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is htonl and ntohl required for data transmission

Status
Not open for further replies.

yeggy

Programmer
Mar 28, 2002
3
US
I am using sockets for data communication and I have this question. While sending binary data from one computer to another using TCP or UDP protocol, is it a good idea to convert the data bytes into network byte order using htonl at the receiver end and convert it back to host byte order at the receiver end using ntohl after reception?
 
> is it a good idea to convert the data bytes into network byte order
It's a good idea to do something which insulates you from changes on your local machine. You don't want to get into the situation where recompiling the code for one machine creates problems for people on other machines.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top