Basic TCP Socket Programming

Source: Internet
Author: User
The 1.listen function Converts an active socket into a passive socket backlog to specify the size of the corresponding socket connection queue. The listener socket has 2 queues: (1) The connection queue is not completed, the client SYN is received, a SYN is sent, an ACK is made, and three handshakes are waiting to be completed. This socket is in the SYN_RCVD state. (2) The connection queue has been completed and the TCP three handshake has been completed. These sockets are in the established state. The 3.getsockname and Getpeername functions either return the local protocol address (GETSOCKNAME) associated with a socket, or return the field protocol address (getpeername) associated with a socket. Description: 1) client, do not call bind, after connect, to obtain their own IP, Port 2) client, after the port number 0 call bind, you can obtain their own port 3) server, to connect IP address call bind, need to establish a connection with the client (accept) In order to get their own IP

Basic TCP Socket Programming

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.