is tcp header timestamp mandatory or optional? and how to generate tcp timestamp

1

I noticed that in all tcp communications, in the tcp header option parts, tcp timestamp is always there is it mandatory or not? so if there is no tcp timestamp in a tcp packet, the tcp client or server will reject it?

besides, I don't find any source snippets for generating tcp timestamps can anyone provide some links or examples on how to generate tcp timestamps?

thanks!

user138126

Posted 2013-03-20T17:37:49.597

Reputation: 215

Answers

3

TCP timestamps are not required, but can help in ordering packets in time. This likely would only matter when you have a lot of TCP retries going on. http://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_timestamps

A TCP packet will not be rejected for lack of a TCP timestamp.

kmort

Posted 2013-03-20T17:37:49.597

Reputation: 1 609

thanks, are there any source snippets for generation of tcp timestamps? – user138126 – 2013-03-20T20:34:20.940

From what I'v seen on the internet, there are no specific units. It's a 4-byte field that you drop your time into. See http://www.networksorcery.com/enp/protocol/tcp/option008.htm and http://msdn.microsoft.com/en-us/library/aa923592.aspx. It looks like the RFC was careful not to specify a unit. You can use a 32-bit representation of your system clock for example.

– kmort – 2013-03-20T20:42:28.570

you meant just use a random number? then how to increase the number for the next packet? – user138126 – 2013-03-20T21:42:24.233

You can use your system clock. I was just saying it doesn't specify if your LSB signifies seconds, nanoseconds, or microseconds or none of the above. That's up to you. – kmort – 2013-03-21T04:22:13.203