Skip to main content

four-way TCP termination

More
18 years 9 months ago #9436 by x1ng
hi there,
if there is a host "A" and host "B" and A wants to terminate a TCP connection with "B"

ACK,FIN SEQ=1000
A
>B

ACK ACK=1001
A<
B

ACK,FIN ACk=1001
A<
B
SEQ=1470

ACK ACK=1470
A
>B

Connection Terminated
<
>

my question is why host "B" has sent two segments (one with ACK and the another with ACK+FIN+SEQ)why he didnt send one segment contain (ack,FIN flag and SEQ)?
More
18 years 9 months ago #9512 by x1ng
Replied by x1ng on topic Re: four-way TCP termination
is that question is not clear or somthing?,
i am sure there is somthing wrong with that question.. :roll: :roll:
More
18 years 9 months ago #9513 by jwj
Replied by jwj on topic Re: four-way TCP termination
Your question was good, x1ng.

My best guess as to why it was designed this way is to allow the tcp connection to be half closed. If host A closes it's side of the connection, it can not send any more packets as that specific connection, it would have to create an entirely new one with host B. However, if host B is still open to host A, it can still send packets as part of that connection.

Here's a quote about this from the TCP article here on firewall.cx:

"If you're wondering why this procedure is required, then you may need to recall that TCP is a Full Duplex connection, meaning that there are two directions of data flow. In our example this is the connection flow from Host A to Host B and vice versa. In addition, it requires both hosts to close the connection from their side, hence the reason behind the fact that both hosts must send a FIN flag and the other host must ACKnowledge it."

I hopes this clears things up.

-Jeremy-
More
18 years 9 months ago #9520 by x1ng
Replied by x1ng on topic Re: four-way TCP termination
1st thank you jwj for you replay .but i have a comment

My best guess as to why it was designed this way is to allow the tcp connection to be half closed. If host A closes it's side of the connection, it can not send any more packets as that specific connection, it would have to create an entirely new one with host B. However, if host B is still open to host A, it can still send packets as part of that connection.


i dont know what you mean by half closed.you mean that if "A" wants to terminate a connection with "B" it will not be a full termination and if "A" wants to send more packets to "B" it will use the same connection.and is this means that there is a half termination and a full termination?or its all half termination and what is the use of half termination? is that to save a throughput by using the same TCP connection after termination?!!
i think I or you missunderstood you or me :roll: :roll:

i have a comment i have got it from a friend about the four-tcp termination

STEP 1: "A" sends a message to say 'I am closing the link. Here is the last of my data'

STEP 2, 3: "B" sends back "okay,( I got the data), (you can close the link)'
"Its two segments"

STEP 4: "A" sends 'okay, I know you got the data and that you are happy for me to close the link (ACK)'

i think host "B"when receive a FIN flag he must ACKnowledg 1st
the data(i go the data) to make sure that no data lost .then it will send the FIN flag to "A" to agree with the termination..
More
18 years 9 months ago #9525 by jwj
Replied by jwj on topic Re: four-way TCP termination
Remember that TCP is a full duplex protocol.

you mean that if "A" wants to terminate a connection with "B" it will not be a full termination and if "A" wants to send more packets to "B" it will use the same connection.


If "A" terminates it's side of the connection, it will need to start all over again, that is three way handshake. "B" will still be able to use it's side of the connection since it's still up. Half-closed connections are not very desirable, and shouldn't happen in most normal connections.

Here is the actual "teardown" steps:

1.) Host "A" ACKnowledges the previous data sent from "B" and is initiating the termination process with the FIN flag.

2.) "B" ACKnowledges that message.

3.) "B" sends it's termination message, FIN and ACK flags set.

4.) "A" ACKnowledges the termination.

Connection is fully closed.

-Jeremy-
Time to create page: 0.136 seconds