Network byte order

Source: Internet
Author: User

A byte order is a sequence of bytes stored in a computer's memory or transmitted by a network, divided into two, big-endian and small-ended

Here's an example of an IP address: an IP address of 32 bits, which requires 4 bytes to store, such as 1.1.1.2 and 2.2.2.1

1.                           Small end little endian: Store low-order bytes at the start address: In line with the thinking habit from small to large, address low storage value of low, address high storage value of high level for the small end machine above the IP address byte storage order: 2.1.1.1 1.2.2.2 Low-to-high 2.                         Big endian: The high-order byte is stored in the start address: In line with the large left small on the right reading habits, address low storage value of low, address high storage value of high-endian machine above the IP address byte storage order: 1.1.1.2 2.2.2.1 Low-to-high network byte-order is big-endian. When processing a network datagram, the byte order needs to be converted via Ntohl (32-bit)/ntohs (16-bit)

Network byte order

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.