Skip to content

Instantly share code, notes, and snippets.

@hardselius
Created February 12, 2022 21:24
Show Gist options
  • Save hardselius/308539e4cb2447034935bcd2f2db9ed2 to your computer and use it in GitHub Desktop.
Save hardselius/308539e4cb2447034935bcd2f2db9ed2 to your computer and use it in GitHub Desktop.

TCP - Transport Layer

Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of octets (bytes) between applications running on hosts communicating via an IP network.

TCP is connection-oriented, and a connection between client and server must be established before data can be sent. The server must be listening (passive open) for connection requests from cilents before a connection is established. Three-way handshake (active open), retransmission, and error detection adds to reliability but lengthens latency. Applications that do not require reliable data stream service may use the User Datagram Protocol (UDP), which provides a connectionless datagram service that prioritizes time over reliability.

UDP - Transport Layer

With User Datagram Protocol (UDP), applications can send messages, referred to as datagrams, to other hosts on an IP network. Prior communications are not required to set up communication channels or data paths.

UDP uses a simple connectionless communication model with a minimum of protocol mechanisms. UDP provides checksums for data integrity, and port numbers for addressing different functions at the source and destination of the datagram. It has no handshaking dialogues, and thus exposes the user's program to any unreliability of the underlying network; there is no guarantee of delivery, ordering, or duplicate protection

UDP is suitable for purposes where error checking and correction are either not necessary or are performed in the application; UDP avoids the overhead of such processing in the protocol stack. Time-sensitive applications often use UDP because dropping packets is preferable to waiting for packets delayed due to retransmission, which may not be an option in a real-time system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment