First post, by mike_canada
Seems people are going for IPV6.
But right now I'm trying to make my own TCP/IP network in pure DOS mode but I want to test it across many emulators and many computers to see if things work, but I haven't gotten past computer 1.
Sometimes my code works and sometimes it doesn't, but I'll explain in pseudo code how my software works:
Let's assume the remote IP address is known and we call it y.
The local IP address is known and we call it x.
The MTU is set to 576 and all IPV4 packets have DF set.
Here's the steps I use and what is going on:
1. x connects to y (issues empty packet with SYN set)
2. y accepts it and responds with SYN-ACK
3. x increments its sequence number and sends full HTTP request and ACK
4. y returns nothing with ACK set
5. y returns normal packet
6. y returns one more packet with PSH set
7. y returns empty packet with FIN set
I always have window at my end set to 536 because MSS = MTU - 40 (IP header size).
The problem is sometimes the connection works wonderful, but most of the time, I only get the first part of the response correct but the second part is half the time incorrect.
I don't use any advanced settings like selective acks and all that. Just the basics and advertising MSS size, that's it.
The only thing I can't figure out which no one on the internet told me is, exactly how do I set the ACK value?
Many sources state ACK value equals sequence number plus the size of the data received. And sources say add 1 to the value if SYN flag is set.
but no one told me if I should increment ACK value if FIN, RST, PSH or any other flag is set.
So for example, if the server returns ACK, FIN, and PSH (which has happened in some cases) with say 100 bytes of data and the sequence number 502, then should ack equal 604 (502 + 100 + FIN=1 + PSH=1)?