The TCP/IP model was developed by the U.S. Department of Defense to ensure accurate and correct data transmission between devices. It breaks messages up into packets to avoid having to resend the entire message if there is a problem during transmission. Packets are reassembled after they reach their destination. Each packet can take a different route between source and destination computer, depending on whether the original route is congested or unavailable.
TCP/IP divides communication tasks into layers that support standardization of the process, without the need for hardware and software management on its own. Data packets must pass through four layers before they are received by the target device, then TCP/IP passes through the layers in reverse order to return the message to its original format.
As a connection-oriented protocol, TCP establishes and maintains a connection between applications or devices until they have finished exchanging data. It determines how the original message should be broken down into packets and numbers, reassembles the packets, and sends them to other devices on the network, such as routers, security gateways, and switches, and then to their destination. TCP also sends and receives packets from the network layer, handles the transmission of any lost packets, manages the flow, and ensures that all packets reach their destination.
A good example of how this works in practice is sending an email using SMTP from an email server. The TCP server layer divides the message into packets, numbers them, and forwards them to the IP layer, which then forwards each packet to the destination e-mail server. When the packets arrive, they are sent to the TCP layer to be reassembled into the original message format and forwarded to the e-mail server, which delivers the message to the user’s mailbox.
TCP/IP uses a three-way handshake to establish a connection between the device and the server, allowing multiple TCP socket connections to be sent simultaneously in both directions. The device and the server must synchronize and acknowledge packets before communication can begin, after which they can negotiate, share, and transmit TCP socket connections.