Socket Programming
Demultiplexing
● Convert host-to-host packet delivery service into
a process-to-process communication channel
Byte Ordering
● Two types of “ Byte ordering”
– Network Byte Order: High-order byte of the number is
stored in memory at the lowest address
– Host Byte Order: Low-order byte of the number is
stored in memory at the lowest address
– Network stack (TCP/IP) expects Network Byte Order
● Conversions:
– htons() - Host to Network Short
– htonl() - Host to Network Long
– ntohs() - Network to Host Short
– ntohl() - Network to Host Long

No comments:
Post a Comment