TCP and UDP are protocols in the transport layer in the OSI model.
TCP definition
TCP (transmission Control Protocol Transmission Protocol ) is a connection-oriented, reliable, byte-stream-based Transport Layer communication protocol defined by the IETF RFC 793.
UDP definition
The UDP (user Datagram Protocol Subscriber Datagram Protocol ) is a connectionless transport layer protocol in the OSI (open System interconnection Open Systems Interconnect) Reference Model, Provides transaction-oriented, simple, unreliable information delivery services.
Difference:
TCP provides a connection-oriented, reliable transmission of data streams;
UDP provides non-connection-oriented, unreliable data flow transmissions.
TCP provides reliable services, data transmitted over TCP connections, error-free, no-loss, no-duplication, sequential arrival, and UDP does its best to deliver, that is, no guarantee of reliable delivery.
TCP-oriented byte stream;
UDP is message-oriented.
The TCP connection can only be point-to;
UDP supports a pair of one or one-to-many, many-to-one, and many-to-many interactive communications.
TCP header overhead 20 bytes;
UDP has a small header overhead and only 8 bytes.
The logical communication channel of TCP is a reliable channel with full duplex;
The logical communication channel of UDP is an unreliable channel.
Usage scenarios:
TCP: Browser, SSH QQ file transfer, etc.
UDP: Audio and multimedia applications, QQ chat, online games and live streaming, etc.
TCP and UDP on the transport layer