Packagecom.smartfoxserver.v2.bitswarm
Classpublic class AirUDPManager
InheritanceAirUDPManager Inheritance Object
Implements com.smartfoxserver.v2.bitswarm.IUDPManager

Runtime Versions : AIR 2.0 and later

The AirUDPManager class allows clients executed in the Adobe AIR runtime to communicate with SmartFoxServer 2X using the UDP protocol.

In order to enable a client to send and received UDP data, a UDP channel must be initialized. This can be done at any moment after having joined a Zone by calling the SmartFox.initUDP() method. If an application uses UDP sockets, we recommend to initialize the UDP channel as soon as the Zone is joined.

NOTE: this class is for use with Adobe AIR 2.0 (or higher) runtime; the standalone or browser-embedded Flash Player does not support this feature.

View the examples

See also

SmartFox.initUDP


Public Methods
 MethodDefined By
  
Creates a new AirUDPManager instance.
AirUDPManager
Constructor Detail
AIR-only AirUDPManager()Constructor
public function AirUDPManager()

Runtime Versions : AIR 2.0 and later

Creates a new AirUDPManager instance.

Examples
The following example initializes the UDP communication and sends a custom UDP request to an Extension:
     
     private function someMethod():void
     {
         sfs.addEventListener(SFSEvent.UDP_INIT, onUDPInit);
         sfs.initUDP(new AirUDPManager());
     }
     
     private function onUDPInit(evt:SFSEvent):void
     {
         if (evt.params.success)
         {
             // Connection successful: execute an Extension call via UDP
             sfs.send( new ExtensionRequest("udpTest", new SFSObject(), null, true) );
         }
         else
         {
             trace("UDP initialization failed!");
         }
     }