Packageorg.tuio.connectors
Classpublic class UDPConnector
InheritanceUDPConnector Inheritance Object
Implements IOSCConnector

An implementation of the IOSCConnector using UDP. This connector only works in Adobe AIR since v2 due to it using the DatagramSocket This connector can be used to send an receive OSC bundles and messages. Though you have to create seperate instances of the connector.



Public Methods
 MethodDefined By
  
UDPConnector(host:String = 127.0.0.1, port:int = 3333, bind:Boolean = true)
UDPConnector
  
Adds a listener for incoming data to a private list.
UDPConnector
  
close():void
Closes the connector
UDPConnector
  
Removes a listener for incoming data to a private list.
UDPConnector
  
sendOSCPacket(oscPacket:OSCPacket):void
Sends an OSCPacket via the connection type implemented by this IOSCConnector.
UDPConnector
Constructor Detail
UDPConnector()Constructor
public function UDPConnector(host:String = 127.0.0.1, port:int = 3333, bind:Boolean = true)

Parameters
host:String (default = 127.0.0.1) — ip of the tracker resp. tuio message producer.
 
port:int (default = 3333) — of the tracker resp. tuio message producer.
 
bind:Boolean (default = true) — If true the UDPConnector will try to bind the given IP:port and to receive packets. If false the UDPConnector connects to the given IP:port and will wait for calls of UDPConnector.sendOSCPacket()

Example
The following code shows three approaches to initialize UDPConnector. Use only one of them:
         //tracker runs on localhost on default port 3333
         var tuio:TuioClient = new TuioClient(new UDPConnector());
         //or 
         //tracker runs on 192.0.0.5 on default port 3333 
         var tuio:TuioClient = new TuioClient(new UDPConnector("192.0.0.5"));
         //or
         //tracker runs on 192.0.0.5 on port 3334
         var tuio:TuioClient = new TuioClient(new UDPConnector("192.0.0.5",3334));
         
Method Detail
addListener()method
public function addListener(listener:IOSCConnectorListener):void

Adds a listener for incoming data to a private list.

Parameters

listener:IOSCConnectorListener — A listener for incoming data

close()method 
public function close():void

Closes the connector

removeListener()method 
public function removeListener(listener:IOSCConnectorListener):void

Removes a listener for incoming data to a private list.

Parameters

listener:IOSCConnectorListener — A listener for incoming data

sendOSCPacket()method 
public function sendOSCPacket(oscPacket:OSCPacket):void

Sends an OSCPacket via the connection type implemented by this IOSCConnector.

Parameters

oscPacket:OSCPacket — The OSCPacket to be sent via this connection.