Reputation: 116
I'm implementing TCP in C/Obj-C.
I have noticed that different servers increment the sequence numbers on some occasions while others don't.
Namely in the teardown process when the server sends a FIN/ACK some servers increase the ACK number by 1 while others dont.
To clarify the problem:
Server 1: The ACK number has been increased to 2
Server 2: The ACK number is still 1. ACK number not increased http://img853.imageshack.us/img853/1248/zf70.png
The output of my program regarding the second server:
FIN(/ACK)# was 18238 but should have been 18239
How should I deal with these kinds of variations of server-side implementation in my code?
Upvotes: 3
Views: 138
Reputation: 1119
Are you referring to some RFC(s) for your implementation? I don't know which RFC contains the correct behaviour (to increment the ACK number or not) when sending a FIN+ACK, but my guess would be that the ACK number should indeed be incremented.
That said, we all know how 'RFC compliant' implementations can be... (and not just TCP implementations)!! That too, for message exchanges that teardown the connection, those who wrote the software must have been extra careless. So now you have two options:
This is a fairly common problem when dealing with distinct implementations of the same standard (which defeats the whole purpose of a standard in the first place). So be warned that this may just be the first of such problems you might encounter.
I have often had to add additional code to handle specific cases when an implementation of a given RFC would work beautifully in Linux, and fail the most basic test on Windows.
Upvotes: 1