TCP

From 118wiki

Jump to: navigation, search

TCP

There is ample material online about TCP. The main things you need to know first are:

  • TCP creates the illusion of reliable transport of data from an unreliable IP network; it does this by packing data into packets, checking for errors, retransmitting where necessary, and changing the order of received data to match the order in which it was sent.
  • TCP (mostly) hides the fact that data is sent in packets, creating the illusion that network communication is a continuous stream of bytes, like file I/O in high-level languages.
  • TCP is based on the abstract idea of a connection between client and server; a TCP connection is established between client and server, and persists for as long as the application needs (subject, of course, to link crashes or other network failures). There is considerable overhead and delay setting up a connection (called the three-way handshake) and also some overhead for "teardown" of the connection when it is finished.
  • Multiple TCP connections between clients and servers is supported because multiplexing, based on port numbers, labels each connection. In fact, each TCP connection is essentially identified as a 4-tuple (source-ip,source-port,dest-ip,dest-port). It's easy to work out examples where there are many simultaneous connections between even one client and one server.
  • Server programs for TCP typically use one port number to identify the server; many clients can set up connections for this port (provided each client has a different source-ip/source-port combination). Client programs usually do not specify their port, instead letting the operating system choose an ephemeral port number.
Personal tools