Htons () Usage

Source: Internet
Author: User
Htons () Description:
Converts the unsigned short integer count of the host to the network byte sequence.
# Include <Winsock. h>
U_short Pascal far htons (u_short hostshort );
Hostshort: The 16-digit host in bytes.
Note:
This function converts a 16-digit sequence from the host byte to the network byte sequence.
Return Value:
Htons () returns the value of a network byte sequence.
See:
Htonl (), ntohl (), ntohs ().
---------------------------------------------
Simply put, htons () is to swap the high and low bits of a number
(For example, 12 34 --> 34 12)
VB:
Msgbox hex (htons (& h1234 ))
The displayed value is 3412.

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.