I have the following query about the tcp handshake.

To establish a connection the server must send a packet with SYN flag to 1 Then the server replies with a SYN,ACK flag to 1 , and afterwards the host (client) replies with ACK flag to 1 and SYN 0.

But to terminate a connection does the host send first termination or the server? Also if its the server is does the server send ACK , FIN to 1 and host replies with ACK 1 and FIN 0?

  • 1
    Either one can end the connection.
    – Ron Trunk
    May 19 '19 at 14:38

TCP does not have clients or servers, that is an application concept. TCP creates peer connections. From the application perspective, either the client or the server could request a connection with the other party, depending on how the application is architected. A server application provides a service to a client application. TCP neither knows nor cares which is a server or client.

In such a peering arrangement, either party can request disconnection. That really depends on how the application or service works. Unfortunately, questions about applications and protocols above OSI layer-4 are off-topic here.

For more information about how TCP operates, you can refer to RFC 793, Transmission Control Protocol, and there is Section 2.7. Connection Establishment and Clearing.

  • im asking because i had a question on a paper asking: packet captured on wireshark has the FIN flag set to 1 : the question was if its from client to server or server to client how is this possible?
    – R AND B
    May 19 '19 at 14:47
  • That is one reason that all "education, certification, or homework" questions are explicitly off-topic here. We have no idea what was taught in the class (there are many things taught with which most network engineers would disagree), so we cannot tell you what is correct for the class. We can only explain what really happens, and we can explain protocol theory. There are cases where clients initiate connections with servers, and there are also cases where servers initiate connections with clients. The same holds true for disconnections.
    – Ron Maupin
    May 19 '19 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.