) What is socket )?

Source: Internet
Author: User
When the application layer uses the transport layer for data communication, TCP and UDP may encounter multiple applications at the same time. Program The process provides concurrent services. Multiple TCP connections or multiple application processes may need
Transmit data through the same TCP port. To differentiate different application processes and connections, many computer operating systems provide Sockets for applications to interact with TCP/IP protocols.
(Socket) interface to distinguish the network communication and connection between different application processes. Generate a socket with three main parameters: Destination IP address for communication, transmission used
The layer protocol (TCP or UDP) and the port number used. The original intention of socket is "socket ". By combining these three parameters and binding them with a "socket" socket, the application layer can communicate
The layer uses Socket interfaces to differentiate the communication between processes or network connections of different applications and implement concurrent data transmission services. The socket can be seen as an endpoint in the communication connection between two programs. One program writes a piece of information into the socket, and the socket sends this information to another socket, this information can be transmitted to other programs. 1: Host
Program A on a writes a piece of information into the socket. The content of the socket is accessed by the network management software of host a, and the information is transmitted through the host
The network interface card of a is sent to host B, and the network interface card of host B receives this information and sends it to host
B's network management software, the network management software saves this information in the socket of host B, and then program B can read this information in the socket. To communicate over the Internet, at least one socket is required. One is run on the client, called clientsocket, and the other is run on the server, called serversocket.
Based on the connection start method and the target to which the local socket is to be connected, the connection process between sockets can be divided into three steps: server listening, client request, and connection confirmation.
Server listener: A server socket does not locate a specific client socket, but is waiting for a connection. It monitors the network in real time. Client request: a connection request is initiated by the client socket. The target is the socket on the server. Therefore, the client socket must first describe the socket of the server to be connected, point out the address and port number of the socket on the server, and then submit a connection request to the socket on the server. Connection
Accept: when the server socket listens to or receives a connection request from the client socket, it responds to the request from the client socket and creates a new thread, send the description of the server socket to the customer
User. Once the client confirms this description, the connection is established. The server socket continues to be in the listening status, and continues to receive connection requests from other client sockets.

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.