Visual C + + Network programming--socket socket programming

Source: Internet
Author: User

Socket : A communication bridge between different hosts in the network, the network communication software function that people use is based on socket socket as communication bridge.

Addressing: In Winsock, users can use a unified socket address structure in the TCP/IP address family To resolve problems that may occur in TCP/IP addressing, as defined below

 1  struct     sockaddr_in{ 2   short  sin_family; //   3  unsigned short  sin_port; //  port number    4  // ip address  5  8 ]; //  reserved, need to be specified as 0  6 }; 

BYTE order: The order in which the data is transferred is based on network byte order and host byte order. From the point of view of data storage, the network is in order to store the most important bytes in the data first, while the host byte order stores the unimportant bytes first.

Winsock provides functions for converting between network byte order and host byte order.

Socket correlation function

1. Constructor Csocket::csocket ();

Exp:csocket sock;

Create a Socket object pointer

CSocket *sock;

Sock=new CSocket;

2. Binding Address Information

  

Visual C + + Network programming--socket socket programming

Related Article

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.