Socket small End Conversion summary (temporary extraction, post-repair original code)

Source: Internet
Author: User

The following summarizes the online harvesting:

In the case of TCP communication, the host byte order and network byte conversions are required. But if the data I want to send is the call to the ReadFile () function to read from the file, that is, the data that is read is saved to the char[] array, will I need to convert the byte order when I send it with the Send function?

--if it's just a byte stream, no conversion is required. Generally is the IP address, port number, the transmission of some integer parameters, only need to do the conversion, the byte stream does not need. If the head records the size, then this record size of the integer number needs to be converted;

--The number types of protocol parsing need to be converted, and the load byte stream does not need to be concerned;

--the data that needs to be made known to the network needs to be converted, such as IP, port number. and the actual data sent, there is no conversion requirements. The data read from the file is your own data, the data will not be converted to look at yourself, anyway, what it is to send out what it looks like.

Socket small End Conversion summary (temporary extraction, post-repair original code)

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.