Two types of transport protocols: TCP,UDPTCP
TCP is the short name of Transfer Control Protocol , which is a connection-oriented protocol that guarantees reliable transmission .
In the TCP/IP protocol,
IP layer is mainly responsible for the location of the network host, the routing of data transmission, by the IP address can uniquely determine a host on the Internet .
The TCP layer provides an application-oriented reliable or unreliable data transmission mechanism , which is the main object of network programming, and generally does not need to care about how the IP layer handles the data.
With the TCP protocol transmission, a sequential error-free data stream is obtained.
A connection must be established between the sender and the receiver's paired two sockets in order to communicate on the basis of the TCP protocol.
When a socket (usually a server socket) waits for a connection, another socket can request a connection, and once the two sockets are connected, they can transmit two-way data and both can send or receive operations.
TCP is a connection-based protocol that can provide reliable data flow between two computers.
This reliable communication channel is required for applications such as HTTP, FTP, and Telnet.
UDP
UDP is the abbreviation of User Datagram Protocol and is a non-connected protocol .
UDP is a protocol that sends a separate packet, called a datagram , from one computer to another, which does not guarantee that the datagram will reach its destination correctly, and that it is a non-connection-oriented protocol.
Each datagram is a separate message, including the full source address or destination address, which travels to the destination on the network with any possible path, so it is not guaranteed to arrive at the destination, the time of arrival, and the correctness of the content.
comparison of TCP and UDP
With UDP, the full address information is given in each datagram, so there is no need to establish a connection between the sender and the receiver .
For the TCP protocol, since it is a connection-oriented protocol, it is necessary to establish a connection before data transfer between sockets, so there is more time to establish a connection in TCP.
There is a size limit for transmitting data using UDP, and each transmitted datagram must be limited to 64KB .
TCP does not have this limitation, and once the connection is established, the sockets on both sides can transmit large amounts of data in a uniform format .
UDP is an unreliable protocol in which datagrams sent by the sender do not necessarily reach the receiver in the same order.
TCP is a reliable protocol that ensures that the receiver is getting all the data sent by the sender in full and proper order.
Reliable transmission is to pay a price, the correctness of the data content inspection will inevitably occupy the computer processing time and network bandwidth. Therefore , the efficiency of TCP transmission is not as high as UDP .
TCP has strong vitality in network communications, such as remote Connection (Telnet) and file Transfer (FTP), which require the data to be reliably transmitted over an indefinite length.
In contrast, UDP is easy to operate and requires less monitoring, so it is often used for client/server applications in decentralized systems with high LAN reliability.
Here is the recommended book "TCP/IP detailed", divided into three volumes.
TCP/IP model
The TCP/IP model consists of four levels:
Application Layer
Transport Layer
Network layer
Network interface
The correspondence between TCP/IP and the OSI Reference Model:
network classes in the JDK
Through the classes in the java.net package, Java programs can communicate over the Internet using TCP or UDP protocols.
Java supports TCP/IP by extending existing streaming input/output interfaces and increasing the creation of input/output object features on the network .
Java supports TCP and UDP protocol families.
TCP is used for reliable streaming input/output of the network.
UDP supports a simpler, faster, point-to-point datagram pattern.
Two types of transport protocols: TCP,UDPTCP
TCP is the short name of Transfer Control Protocol , which is a connection-oriented protocol that guarantees reliable transmission .
In the TCP/IP protocol,
IP layer is mainly responsible for the location of the network host, the routing of data transmission, by the IP address can uniquely determine a host on the Internet .
The TCP layer provides an application-oriented reliable or unreliable data transmission mechanism , which is the main object of network programming, and generally does not need to care about how the IP layer handles the data.
With the TCP protocol transmission, a sequential error-free data stream is obtained.
A connection must be established between the sender and the receiver's paired two sockets in order to communicate on the basis of the TCP protocol.
When a socket (usually a server socket) waits for a connection, another socket can request a connection, and once the two sockets are connected, they can transmit two-way data and both can send or receive operations.
TCP is a connection-based protocol that can provide reliable data flow between two computers.
This reliable communication channel is required for applications such as HTTP, FTP, and Telnet.
UDP
UDP is the abbreviation of User Datagram Protocol and is a non-connected protocol .
UDP is a protocol that sends a separate packet, called a datagram , from one computer to another, which does not guarantee that the datagram will reach its destination correctly, and that it is a non-connection-oriented protocol.
Each datagram is a separate message, including the full source address or destination address, which travels to the destination on the network with any possible path, so it is not guaranteed to arrive at the destination, the time of arrival, and the correctness of the content.
comparison of TCP and UDP
With UDP, the full address information is given in each datagram, so there is no need to establish a connection between the sender and the receiver .
For the TCP protocol, since it is a connection-oriented protocol, it is necessary to establish a connection before data transfer between sockets, so there is more time to establish a connection in TCP.
There is a size limit for transmitting data using UDP, and each transmitted datagram must be limited to 64KB .
TCP does not have this limitation, and once the connection is established, the sockets on both sides can transmit large amounts of data in a uniform format .
UDP is an unreliable protocol in which datagrams sent by the sender do not necessarily reach the receiver in the same order.
TCP is a reliable protocol that ensures that the receiver is getting all the data sent by the sender in full and proper order.
Reliable transmission is to pay a price, the correctness of the data content inspection will inevitably occupy the computer processing time and network bandwidth. Therefore , the efficiency of TCP transmission is not as high as UDP .
TCP has strong vitality in network communications, such as remote Connection (Telnet) and file Transfer (FTP), which require the data to be reliably transmitted over an indefinite length.
In contrast, UDP is easy to operate and requires less monitoring, so it is often used for client/server applications in decentralized systems with high LAN reliability.
Here is the recommended book "TCP/IP detailed", divided into three volumes.
TCP/IP model
The TCP/IP model consists of four levels:
Application Layer
Transport Layer
Network layer
Network interface
The correspondence between TCP/IP and the OSI Reference Model:
network classes in the JDK
Through the classes in the java.net package, Java programs can communicate over the Internet using TCP or UDP protocols.
Java supports TCP/IP by extending existing streaming input/output interfaces and increasing the creation of input/output object features on the network .
Java supports TCP and UDP protocol families.
TCP is used for reliable streaming input/output of the network.
UDP supports a simpler, faster, point-to-point datagram pattern.
Java Network Programming (ii) two types of transport protocols: TCP UDP