Let's create the whole process of tcp connection establishment, http request and response and tcp connection termination.
- Content of my files:
/var/www/html/phplearn/send.php
<form action="http://127.0.0.1/phplearn/do.php" method="post">
name: <input type="text" name="userName" size="12"/>
key: <input type="text" name="PS" size="12"/>
<input type="submit" value="login">
</form>
/var/www/html/phplearn/do.php
<?php
$userName = $_POST["userName"];
$PS = $_POST["PS"];
echo "the name is: ".$userName;
echo "<br>key word is: ".$PS;
?>
Opening tcpdump with this parameters:
sudo tcpdump -i lo host 127.0.0.1 -w /tmp/dataDst.pcap
Sending info with curl
curl -d "userName=test&PS=test_pass" 127.0.0.1/phplearn/do.php
Opening /tmp/dataDst.pcap with wireshark
Process1: tcp connection establishment.
From no1 till no3,no problem.
Process2:http request and response.
no5 client send http request from port 38219 to 80 at server
no6 server send tcp signal to client
no7 server send http response to client
Process3:tcp connection termination
The process of tcp connection termination observed from tcpdump totally differ from the diagram on web.
In my observation,
no7 from client on port 38219 to server port 80 ACK
no8 from client on port 38219 to server port 80 FIN
no9 from server port 80 to client on port 38219 FIN
no10 from client on port 38219 to server port 80 ACK
From the diagram, there are two tcp packets from client to server and two tcp packets from server to client .
From my tcpdump, there are three tcp packets from client to server and only one tcp packet from server to client.
Could you explain the cause for the difference between my observation and the sequence diagram in detail?


