Skip to main content
gamedev.net
🔒 Locked

sequence numbers

Started by Ponl Jan 21, 2008 at 1:34 AM 4 replies 1.2k views
Original Post
Ponl
Ponl
Hello all, I hope I'am not posting something that has already been posted. I'am programming a reliable udp layer and I was wondering why we need to send the sequence number with the syn packet. Why don't we just use 0 for the initial sequence number ? Also what do i do when the sequence number wraps ? Do I resent a syn packet ? Thanks a lot in advance, In case Iam not being clear please tell me as I will try to reclarify. Cheers Ponl
Zao
Zao
As for sequence number wrapping, you typically have a wrapping window determining the valid sequence numbers.
To make it is hell. To fail is divine.
Antheus
Antheus
Quote:
Original post by Ponlwhy we need to send the sequence number with the syn packet.

You don't *need* to send it. If you design your protocol in such a way, then you send it.

It may help with handshake, but isn't strictly needed.


Quote:
Why don't we just use 0 for the initial sequence number ?


You can.


What kind of protocol you design is entirely up to you, unless you're trying to re-implement an existing one which mandates a specific use of sequence numbers in handshake.

Quote:
Also what do i do when the sequence number wraps ?


Nothing has changed, since sequence numbers are continuous, the wrap will occur both on sender and receiver at the same time. And since you need to receive them in order, you'll know exactly when it wraps. If you increment the sequence numbers by one, then you don't even need to check for overflow.
Ponl
Ponl
Thanks a lot !
Just out of intrest, does anybody know why tcp syncronizes its sequence number when it sends its syn packet ?

Cheers
Ponl

hplus0603
hplus0603
Starting at a point other than 0 has two benefits.
1) A random fragment arriving late from some old connection will be less likely to have a valid sequence number.
2) It's harder to guess the sequence number for someone who wants to run a replay or spoofing attack.
enum Bool { True, False, FileNotFound };
Ponl
Ponl
Ack!

Thanks
Ponl

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.