ntohs


 
Thread Tools Search this Thread
Top Forums Programming ntohs
# 1  
Old 09-15-2001
ntohs

" How do i write the function specifying the processor supports little-endian or big-endian"----May be similar to ntohs?????
# 2  
Old 09-16-2001
Are you trying to write your own htons/ntohs
functions? If you use these functions when
transferring data across a network between
machines, you don't have to worry about it
since the compiled program will do it correctly
for that hardware architecture.

The rule is:
Network byte order, as used on the
Internet, is Most Significant Byte first.

On the i80x86 the host byte order is Least Significant Byte first.
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

htons and ntohs

Hi All, I am running a short program on the effects of host-to-network and network-to-host functions. The following is part of my code: int a = 384; printf("Used htons with a, getting: %x Hex and %d Numeral\n", htons(a), htons(a)); printf("Used ntohs with a, getting: %x Hex and %d... (1 Reply)
Discussion started by: dbshuis
1 Replies
Login or Register to Ask a Question