TCP/IP
The family of networking protocols that powers the internet. IP addresses packets and moves them across networks, while TCP gives applications an ordered stream of bytes.
Two jobs, two protocols
When an API client connects to a server, IP gets packets across the network, and TCP turns those packets into a byte stream the applications can use. The name TCP/IP usually means the whole Internet protocol suite, not a rule that every IP packet must carry TCP. UDP is another transport protocol in the same suite.
How the layers fit together
- Application: Protocols such as HTTP and DNS define what the data means and how applications exchange it.
- Transport: TCP and UDP use ports so the operating system can direct incoming data to the right socket. TCP delivers an ordered byte stream; UDP sends separate datagrams without built-in delivery or ordering guarantees.
- Internet: IPv4 and IPv6 provide packet addressing. Routers use the destination IP address to decide where to forward a packet next. IP does not promise delivery or preserve packet order.
- Link: A technology such as Ethernet or Wi-Fi carries the packet across one local link. The next link on the route may use different technology.
A typical TCP connection opens with a three-way handshake: the client sends SYN, the server replies with SYN-ACK, and the client sends ACK. Once data starts flowing, TCP uses sequence numbers to track bytes and acknowledgments to learn what the peer has received. It retransmits data it detects as lost. If bytes arrive out of order, TCP keeps later bytes from the receiving application until the gap is filled. That is what reliable, ordered delivery means here: the application gets bytes in order, but a connection can still fail.
Example: from DNS lookup to API response
Say your backend makes its first HTTPS request to api.example.com using HTTP/1.1. If it doesn't already have an address, it resolves the hostname through DNS. It then opens a TCP connection to that address on port 443, negotiates TLS, and sends the HTTP request over the encrypted connection. These steps matter when debugging: a certificate validation error happens during TLS setup, while a 503 means an HTTP endpoint responded. Don't assume all HTTPS follows this exact path: HTTP/3 runs over QUIC, which uses UDP.
What interviewers look for
A common question is whether one send() matches one recv(). It doesn't: one read can return part of a message or bytes from several messages. To send structured messages over TCP, the application protocol needs a way to mark their boundaries, such as a length prefix. Another common trap is treating a TCP acknowledgment as proof that a request succeeded. It only confirms that the peer's TCP stack received bytes. If you need confirmation that a database write committed, look for a response defined by the application protocol.