I’m building my own webserver based on a tutorial.
I have found a simple way to initiate a TCP connection and send one segment of http data (the webserver will run on a microcontroller, so it will be very small)
Anyway, the following is the sequence I need to go through:
-
receive SYN
-
send SYN,ACK
-
receive ACK (the connection is now established)
-
receive ACK with HTTP GET command
-
send ACK
-
send FIN,ACK with HTTP data (e.g 200 OK)
-
receive FIN,ACK <- I don’t recieve this packet!
-
send ACK
Everything works fine until I send my acknowledgement and HTTP 200 OK message.
The client won’t send an acknowledgement to those two packages and thus
no webpage is being displayed.
I’ve added a pcap file of the sequence how I recorded it with wireshark.
Pcap file: http://cl.ly/5f5/httpdump2.pcap
All sequence and acknowledgement numbers are correct, checksum are ok. Flags are also right.
I have no idea what is going wrong.
The IP length field was consequently counting 8 bits too much. I made a mistake in my calculations. Everythings works like a charm now!