socket interpretation, HTTP and socket long connection and short connection difference.
TCP/IP
TCP/IP is a protocol group that can be divided into three levels: Network layer, Transport layer and application layer.
At the network layer are IP protocols, ICMP protocols, ARP protocols, RARP protocols, and BOOTP protocols.
There are TCP protocols and UDP protoc
The simple explanation is:Short connection: Establish a connection, send a packet, close the connectionLong connection: Establish a connection, send a packet, send a heartbeat packet, send a packet, send a heartbeat packet, send a heartbeat packet ...So with frequent data transmission, a short connection creates a TCP connection frequently, and for long connections, the same TCP connection is always usedPackage Com.tree.demo.socket;import Java.io.ioex
The simple explanation is:
Short connection: Establish a connection, send a packet, close the connection
Long connection: Establish a connection, send a packet, send a heartbeat packet, send a packet, send a heartbeat packet, send a heartbeat packet ...
Therefore, frequent data sending and receiving, the short connection will frequently create a TCP connection, and for long connections, always use the same
Tcp / ip
TCP/IP is a protocol group that can be divided into three tiers: the network layer, the transport layer, and the application layer.
There are IP protocols, ICMP protocols, ARP protocols, RARP protocols and BOOTP protocols on the network layer.
There are TCP protocols and UDP protocols in the transport layer.
In the application layer are: TCP includes FTP, HTTP, TELNET, SMTP and other protocols
UDP includes DNS, TFTP, and other protocols
Short
interrupts the connection.It is also possible to say that a short connection is when the socket connection is sent and the data is disconnected immediately after it is received.Long connections:Connect, transfer data--keep connected, transfer data ... , close the connection.A long connection is when a socket connection is established, regardless of whether it is
Thomescai Http://blog.csdn.net/thomescai (reprint please keep)
Summary:
Before these concepts a little confused, look up some information, a little summary of their differences. If there is a mistake, please shoot ~ ~ ~
First look at the picture:
What TCP/IP is.
TCP/IP is a protocol group that can be divided into three tiers: the network layer, the transport layer, and the application layer.There are IP protocols, ICMP protocols, ARP protocols, RARP protocols and BOOTP protocols on the network
TCP/IPTCP/IP is a protocol group that can be divided into three levels: Network layer, Transport layer and application layer.At the network layer are IP protocols, ICMP protocols, ARP protocols, RARP protocols, and BOOTP protocols.There are TCP protocols and UDP protocols in the transport layer.At the application level: TCP includes FTP, HTTP, TELNET, SMTP, and other protocolsUDP includes DNS, TFTP, and other protocolsShort ConnectionConnection, transfer data, close connectionHTTP is stateless,
TCP/IPTCP/IP is a protocol group that can be divided into three levels: Network layer, Transport layer and application layer.At the network layer are IP protocols, ICMP protocols, ARP protocols, RARP protocols, and BOOTP protocols.There are TCP protocols and UDP protocols in the transport layer.At the application level: TCP includes FTP, HTTP, TELNET, SMTP, and other protocolsUDP includes DNS, TFTP, and other protocolsShort ConnectionConnection, transfer data, close connectionHTTP is stateless,
TCP/IPTCP/IP is a protocol group that can be divided into three levels: Network layer, Transport layer and application layer. at the network layer are IP protocols, ICMP protocols, ARP protocols, RARP protocols, and BOOTP protocols. There are TCP protocols and UDP protocols in the transport layer. at the application level: TCP includes FTP, HTTP, TELNET, SMTP, and other protocolsUDP includes DNS, TFTP, and other protocolsShort Connectionconnection, transfer data, close connectionHTTP is stateles
connections are often used for frequent operation, point-to-point communication, and the number of connections cannot be too much.Each TCP connection requires a three-step handshake, which takes time, and if each operation is connected first, then the processing speed is much lower.So after each operation is kept open, the next time processing directly send packets on the OK, do not have to establish a TCP connection. For example, a database is connected with a long connection,If frequent commu
) → data transmission → keep connected (heartbeat) → ... → Close connection;This requires long connection in the absence of data communication, timed to send packets (heartbeat) to maintain the connection status, short connection in the absence of data transmission directly close on the line when the long connection, short connection.
Long connection is often used for frequent operation, point-to-point c
1 Concepts
Socket:socket is actually an encapsulation of TCP/IP, and we can use socket sockets to transmit through the socket. One of the first concepts we need to understand is the channel, which is simply a channel where two pairs of ports can transmit data at any time. What I often say is the so-called establishment of socket connection, that is, the establis
can receive the data correctly each time, this experiment can prove).So since the socket itself supports long connections, why do we have to mention the concept of short connections? Imagine a China Mobile SMS gateway (that is, by releasing the socket Communication interface) every time every minute there are more than n connections to send SMS requests, join th
connection: A short connection for frequent operation, point-to-point communication, and the number of connections can not be too many cases. Each TCP connection is established with a three-time handshake, and each TCP connection disconnects four times.If each operation to establish a connection and then the operation of the processing speed will be reduced, so each time the operation of the next operation to send data directly, no longer establish a
) → data transmission → keep connected (heartbeat) → ... → Close connection;This requires long connection in the absence of data communication, timed to send packets (heartbeat) to maintain the connection status, short connection in the absence of data transmission directly close on the line when the long connection, short connection.
Long connection is often used for frequent operation, point-to-point com
connection every time they perform an HTTP operation, but the connection is interrupted when the task ends.It can also be said that a short connection means that the connection is closed immediately after the socket connection is sent and the data is received.Persistent connection:Connection> data transmission> keep connection> data transmission>... -> Close the connection.Persistent connection means that
This is a creation in
Article, where the information may have evolved or changed.
Through the first two chapters, we succeeded in writing out a set of server and client that could be used, and communicated through protocol between them. So, a simple socket communication framework has been embryonic, then we are going to do is to find a way to make this framework more stable, healthy ~
As a server that is likely to communicate with many clients, the fi
A long connection is once a client logs on to the server and its connection to the server does not close, regardless of how many transactions are made between them, until the client exits the login or the network fails.This technology is implemented in online trading systems to improve efficiency.A short connection is a client each request to establish a connection with the server, the transaction is completed after closing the connection, this tec
when the task ends. You can also say that a short connection means that the connection is closed immediately after the data is received after the socket connection is sent. persistent connection: connection> data transmission> keep connection> data transmission>... -> Close the connection. persistent connection means that the connection is established after a soc
The emergence and prevalence of short links have benefited from the development of social networks. Short links can be easily transmitted over the network, avoiding exceeding the character limit, making it easier for the sharing address to count the access information of this address.
The following is Sina Weibo API short chain interface Description: http://open.
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.