In what byte order does data transfer occur on net? Is it Little Endian or big endian? How is it converted to the respective byte order once the data reaches the host ?
if you are using tcp using htons((short)port) enables you to use network safe protocol(basically big endian) and dont care about little vs. big endian.
if you do need to convert use
http://www.codeguru.com/forum/showthread.php?t=292902