Transmission Control Protocol (TCP) is a connection-based protocol that ensures reliable transmission across networks, delivering data in sequence without errors, loss, or duplication. Use TCP for applications that require a reliable stream of data between programs running on different computers or different targets within a system. TCP permits multiple, simultaneous connections between computers and targets. You can use TCP to send byte streams between a client and a server.
TCP clients and servers must establish a connection before transferring data. Establishing a connection involves listening for a connection on the server and opening a connection on the client at the port where the server is listening. After establishing a connection, the client can reliably send commands to and receive responses from the server. Unlike in TCP network communication, UDP senders and receivers do not need to establish a connection before transferring data. If you don't need highly reliable network communication and want to transfer data with lower latency, you can use UDP network communication.