Paratrooper Digital

Getting data from the TUIO tracker into flash

Flash can connect to TUIO data services in one of three ways; TCP, UDP, LocalConnection. Here’s a breakdown of those methods.

  • TCP

    TCP is the protocol most requests are transferred through. HTTP web requests transfer over TCP; including loading XML files, CSS files, images and SWFs. The good thing about TCP is that you don’t lose packets, every packet gets received and a response is sent to let the server know it was received. It allows a flash experience on one computer to pull in data from a server on a different computer. The downside of TCP is that its the slowest of the possible methods. It’s common to use an XML Socket when using TCP connections, the XML sockets can have potential security issues.

  • UDP

    UDP is a protocol for sending as much data as possible, without regard for if it was picked up. This is the native method of data being sent out with TUIO. Until recently flash was unable to process UDP data. It’s now able to have UDP connections, but only via AIR applications. This is super fast and since most TUIO servers send data over UDP there’s no need for a bridge that translates the data from UDP to another protocol. The downside is that its only available in AIR.

  • LocalConnection (LC)

    LC is currently the best method of sending TUIO data into flash, its fast and there’s very little overhead of converting the data from one format to another as it’s all converted to binary in a method flash understands. The downside is that local connection only works on the same machine, it also requires a bridge to convert UDP data to LC.

Flash can also receive data through ExternalInterface, but that would require that the SWF be in a wrapper (most commonly HTML, but could be a .NET or similar wrapper) that receives the data and passes it along into the SWF by directly calling methods on it. Since this could introduce an additional layer, it’s not explored more as an option. Note that there could be security concerns/hurdles for allowing data to be passed over ExternalInterface.

By default from the TUIO specification data is sent from a gateway over UDP. Because there are multiple ways to consume the data that may not include processing via UDP, TUIO output Bridges are available that interpret UDP data and convert it to another format for consumption.

One thing to note is that some gateways send TUIO data over binary while others send it in a human readable format, this is important when reviewing the different bridges available.

Comments are locked for this content.

About Nate Frank

Nate is currently a Senior Presentation Layer Architect at Razorfish Chicago. As an SPLA Nate: participates in technology leadership team and resource allocations, manage fulltime and contractor resources, represents technology for groups of brands across multiple clients, furthers development of standards within the office, architects project implementations and fosters community and mentoring.

View all posts by Nate Frank

Most recent posts

Categories