TCP

TCP is a connection-oriented protocol that has end-to-end reliability. TCP begins a session with a three-way handshake and ends the session with an exchange of FIN packets. TCP has an 11-field header, and sequences and acknowledges data, to ensure that all the data arrives at the end device. 

Once in a connection, TCP progresses through a series of states. For example, in the screenshot named Netstat showing active connections, you can see the ESTABLISHED and TIME-WAIT states.

TCP states are as follows:

  • LISTEN: The system waits for a request from a remote host to connect.
  • SYN-SENT: After the client sends a request for a connection, the system waits for a response.
  • SYN-RECEIVED: After the SYN request has been returned to the client, the server waits for a final ACK to start the connection.
  • ESTABLISHED: A normal state where the two endpoints are actively communicating.
  • FIN-WAIT-1: The host waits for either an ACK in response to a FIN set to the remote host, or a FIN from the remote host.
  • FIN-WAIT-2: The host waits for a FIN request from the remote host.
  • CLOSE-WAIT: This means the server has received a FIN packet from the client and is waiting to end the session.
  • CLOSING: After the FIN packet has been sent, the host begins closing the connection and waits for a corresponding acknowledgment, in order to fully close the session.
  • LAST-ACK: A final acknowledgment after sending the FIN packet is to make sure the remote host has received the termination request.
  • TIME-WAIT: After sending a termination request, this state waits to ensure that the remote host has received the request to end the conversation.
  • CLOSED: This is not a state at all; it represents a closed connection.

For a connection-oriented session where it is important to get all the parts of the communication stream, TCP is the transport layer protocol of choice. However, when speed in data transport is required, UDP is the better choice. UDP is a connectionless protocol with only four field values, as we can see in this next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.134.90.44