TCP is connection-oriented, meaning once a connection has been established, data can be transmitted in two directions. TCP has built-in systems to check for errors and to guarantee data will be delivered in the order it was sent.
It uses a 3-way handshake to establish a reliable connection. The connection is full duplex, and both sides synchronize (SYD) and acknowledge (ACK) each other. The exchange of these four flas is performed in 3 steps -- SYN, SYN-ACK, and ACK.
UDP is a simpler, connectionless internet protocol wherein error checking and recovery services are not required. There is no overhead for opening, maintaining and terminating a connection. Data is continuously sent to the recipent, whether or not they receive it.
Feature | TCP | UDP |
---|---|---|
Data sequencing | ✓ | X |
Guaranteed delivery | ✓ | X |
Retransmission of data | ✓ | X |
Error checking | Extensive | Basic like checksums |
Speed | Slower than UDP | Faster than TCP |
Broadcasting | X | ✓ |
Optimal use | HTTPS, HTTP, SMTP, POP, FTP | Video conferencing, streaming, DNS, VoIP |