Detect UDP

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

Moderators: Lapo, Bax

Post Reply
User avatar
janheuninck
Posts: 68
Joined: 23 Nov 2011, 01:35
Location: Vancouver BC, Canada

Detect UDP

Post by janheuninck »

Hi,

How can I detect if a message from the client is sent via UDP or TCP in

Code: Select all

SFSRequestHandler extends BaseClientRequestHandler
?


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

Re: Detect UDP

Post by Lapo »

You should know it because you decide it on the client side and viceversa.
Each "command" sent from client or server has an id, which is string, example "fireBullet", "move", "jump" etc... For each of these requests you should decide if you want to send them with TCP or UDP. This is not dynamic, it's planned beforehand.

Whenever you can compensate for the loss of one or more packets you can use UDP, and whenever you need the guarantee that a message will be delivered you use TCP.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply