Transmission Control Protocol or TCP is a protocol about the ways in which data is exchanged between computers. Almost all current operating systems of modern computers understand TCP and use it to exchange data with other computers. TCP protocol is a reliable, connection-oriented, packet-switched transport protocol in computer networks. TCP is part of the Internet protocol suite (including IPv6). The work of TCP is to divide the information to be provided with a header and send it to the Internet Protocol (IP).
Gross summary on TCP or Transmission Control Protocol
TCP is in principle an end-to-end connection, which permits the transmission of the information in both directions, analogous to a telephone conversation. TCP software is usually located in the network protocol stack of the operating system. Each TCP connection is uniquely identified by two endpoints. Each endpoint is an ordered pair composed of IP address and port. Such a pair forms a bidirectional software interface and is also known as Socket.
Function of TCP in a Network

A server listens on port 80 for incoming connections and sets up a connection for a client and continues the connection to another socket. Thus it is possible that a Web server is open to several simultaneous connections to different machines. Multiple lists is not possible on the same port. On the client side, any port number is assigned with 1024. Ports are 16-bit numbers (port numbers) and range from 0 to 65535. Ports 0 to 1023 are reserved, port 80 is for the World Wide Web using HTTP protocol, Port 110 is or pop3 and so on.
---
If a client establish a connection, it creates a socket from its own IP address and an unique port number. A TCP connection is uniquely identified by four values.
During the data transfer phase the role of client and server, from TCP point of view are completely symmetrical. During the closing or termination, the connection can then be semi-open. Because of transmission problems can occur when duplicate data packets, all TCP packets and TCP messages are identified with a consecutive sequence number.
