the socket implements a physical connection between the server and the client and transmits data. There are mainly tcp/udp of two protocols. The socket is in the transport layer of the network protocol. TCP: Transmission Control Protocol, connection-oriented protocols, stable and reliable. Before the customer and the server Exchange data with each other, a TCP connection must be established between the two parties before the data can be transferred.
UDP: Broadcast data transmission, UDP does not provide reliability, it simply sends the application to the IP layer of the datagram sent out, but does not guarantee that they can reach the destination. Because UDP does not have to establish a connection between the client and the server before transmitting the datagram, and there is no mechanism such as time-out retransmission, the transmission speed is very fast. Advantages: 1. Transfer data is byte-level, transfer data can be customized, the amount of data is small. Corresponding mobile development, mobile phone costs 2 lower. Transfer data time is short, high performance 3. Suitable for real-time interaction between C/S information 4. Can be encrypted, data security is high disadvantage: 1. The data that is transmitted must be parsed and translated into application-level data 2. The developer level requires 3. TTP protocol transmission, increased amount of development HTTP requests mainly have HTTP protocol, HTTP protocol-based SOAP protocol, common HTTP data request method has get and Post,web service advantages: 1. Application-level-based interface easy to use 2. The requirements of the development level is not high, fault-tolerant strong disadvantage: 1. The transmission speed is slow, the packet is large. 2. If real-time interaction is achieved, the server performance pressure is 3. Poor data transfer security
Individual features, differences, and scenarios for socket requests and HTTP requests