Posts Tagged ‘SmartFoxserver 2X and its restrictions’

UDP protocol with SmartFoxserver 2X and its restrictions

March 11th, 2011 by aabhaanjan

Although the default protocol is TCP , now SmartFoxServer 2X is also supporting UDP for clients like Unity3D and AIR 2.0 for Flash developer.

Why Support for UDP  ? :

To achieve higher performance, the protocol allows individual packets to be dropped (with no retries) and UDP packets to be received in a different order than they were sent as dictated by the application.

Differences in between TCP and UDP :

TCP offers error correction. When the TCP protocol is used there is a “guaranteed delivery.” This is due a method called “flow control.” Flow control determines when data needs to be re-sent, and stops the flow of data until previous packets are successfully transferred. This works because if a packet of data is sent, a collision may occur. When this happens, the client re-requests the packet from the server until the whole packet is complete and is identical to its original.
However, UDP is never used to send important data such as webpages, database information, etc;

UDP is commonly used for streaming audio and video because it offers speed! The reason UDP is faster than TCP is because there is no form of flow control or error correction. The data sent over the Internet is affected by collisions, and errors will be present. UDP is only concerned with speed. This is the main reason why streaming media is not high quality.

UDP restrictions for Flash

As you can notice from the above snippet of code the initUDP method takes an argument:

sfs.initUDP(new AirUDPManager())

Adobe’s support for UDP is in fact only available for standalone applications based on the AIR runtime(version 2.0 and higher) while no support is provided for Flash and Flex applications running in the browser.

In order to be able to support SFS2X introduced the AirUDPManager class .

Tags: , , , , , , , , , ,