TCP and UDP Flashcards
Define TCP
TCP operates at the transport layer and is a connection-oriented protocol. Before any data is sent, a connection must be established first. The 3 characteristics of TCP are that it’s connection-oriented, uses sequencing and checksums, and incorporates flow control.
Three-way handshake
A three-step process used by TCP to establish a connection.
Define Checksum
A character string sent by TCP, which is then repeated by the destination host. The 2 checksums need to match, otherwise the destination host will ask the source to retransmit the data.
Flow Control
The process of gauging the appropriate rate of transmission based on how fast the receiver can accept data.
How are TCP headers constructed?
Constructed in groups of 32 bits called words. Each word consists of 4 bytes (blocks) of 8 bits each. The header consists of many fields, including source and destination ports, sequence number, checksum, etc.
Source and Destination ports
These indicate the ports at the source and destination nodes. Each are 16 bits in length. The port allows a process to be available for incoming/outgoing data.
Sequence Number
A 32-bit field that identifies the data segment’s position in the stream of data segments being sent.
Acknowledgement number
32-bit field that confirms receipt of data via a return message to the sender.
Flags
A 6-bit field that identifies a collection of 6 1-bit fields/flags that indicate special conditions about other fields in the header. Includes URG (urgent), ACK (acknowledgement), PSH (no buffering), RST (reset), SYN (synchronization), and FIN (last segment in sequence)
Sliding-window size
A 16-bit field that indicates how many bytes the sender can issue to a receiver before receiving acknowledgement.
Urgent Pointer
16-bit field, where urgent data is located.
Padding
A variable-length field that contains filler bits to ensure the size of the TCP header is a multiple of 32 bits.
What are the 3 steps in a TCP three-way handshake?
- SYN - request for a connection. Source computer sends a random number to synchronize communication, with SYN bit set to 1.
- SYN/ACK - Response to the request. Receiving computer receives the message, responds with ACK and SYN bits set to 1 (Random number from step 1, plus 1)
- ACK - connection established. Source computer responds with the same sequence number, with ACK bit set to 1.
Initial Sequence Number (ISN)
The first sequence number used in a three-way handshake. It is calculated by a specific clock-based algorithm which varies by operating system. Because of its predictability, this is actually a security loophole that can be exploited by a hacker.
Define UDP
UDP = User Datagram Protocol. It is a connection-less protocol. Although faster and more efficient than TCP, it does not guarantee delivery of data. Does not have a 3-way handshake. Provides no error checking, sequencing, or flow control.