Sockets provide the communication mechanism between two computers using TCP. A client program creates a socket on its end of the communication and attempts to connect that socket to a server. When the connection is made, the server creates a socket object at the end of the communication. The client and the server can now communicate by writing to and reading from the socket.