| Package | com.smartfoxserver.v2.bitswarm |
| Class | public class AirUDPManager |
| Inheritance | AirUDPManager Object |
| Implements | com.smartfoxserver.v2.bitswarm.IUDPManager |
| Runtime Versions : | AIR 2.0 and later |
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.
See also
| Method | Defined By | ||
|---|---|---|---|
Creates a new AirUDPManager instance. | AirUDPManager | ||
| () | Constructor |
public function AirUDPManager()| Runtime Versions : | AIR 2.0 and later |
Creates a new AirUDPManager instance.
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!");
}
}