TCP is used to create a reliable byte stream connection between two network hosts. The host that listens for incoming connections is referred to as the server, and the host that initiates a connection the client. Although TCP and UDP both use IP, TCP sends information as a stream of data. There are no record markers to delimit the data. For example, if a server is sending analog-to-digital (A/D) readings to a client, the client will see a stream of digits; TCP will not automatically insert delimiters to allow the client to determine where one measurement ends and the next begins. To the client, the stream may look like: “98273129323424”. Even if the client knew each reading was 4 digits, it would not know where one ended and the next began. Four parameters are required for a TCP connection: source IP address, source port number, destination IP address, and destination port number.
In contrast to TCP, UDP (covered in the next chapter) is an unreliable, datagram-oriented connectionless protocol. Delivery is not guaranteed, but each output operation creates and sends one UDP datagram. In the above A/D example, each reading (or some number of multiple readings) could be sent as a single datagram and the client could then process one datagram at a time.