sfs2x packet sequencing

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

andisopany
Posts: 33
Joined: 19 Sep 2015, 01:15

sfs2x packet sequencing

Postby andisopany » 12 Jul 2018, 01:51

Hi,

Consider the case:

Client A sends message 1 to an sfs room which calls method B then sends packet F to client B
Client A sends message 2 to an sfs room which calls method C then sends packet G to client B

Is it guaranteed that client B receives packet F before packet G.

In my use case I believe I am seeing an unexpected ordering about 30% of the time.

This is not a requirement for me but I would like to know if this is what is happening.

Thanks

Matt
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: sfs2x packet sequencing

Postby Lapo » 12 Jul 2018, 08:03

Hi,
Client A sends message 1 to an sfs room which calls method B then sends packet F to client B
Client A sends message 2 to an sfs room which calls method C then sends packet G to client B

Is it guaranteed that client B receives packet F before packet G.

Normally yes but it's not a 100% guarantee.
It depends how fast the two messages are sent. If message1 and message2 are hundreds of milliseconds apart (at least) then yes, you will see F before G.

If the two messages are sent very rapidly (few ms apart) chances are they will be aggregated by the TCP and get to the server together. If this is the case then it all depends on which server side methods (B and C) will finish first.
The first method to finish will enqueue its response packet in the outgoing queue and determine which packet gets first to the client.

Makes sense?

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
andisopany
Posts: 33
Joined: 19 Sep 2015, 01:15

Re: sfs2x packet sequencing

Postby andisopany » 14 Jul 2018, 19:55

Thanks Lapo,

The two packets are sent in the same frame so that is definitely the case.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: sfs2x packet sequencing

Postby Lapo » 15 Jul 2018, 06:19

Why not sending a single request instead?
If you do so, it won't be handled by separate threads and there's no concern for out-of-order execution.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Baidu [Spider], Stevenor and 48 guests