Setting up XML socket connectivity

A network socket is a communication mechanism that makes a connection between devices through programs constant. Specifically, the endpoints for sending and receiving data between computers are referred to as sockets. Socket connections typically use a client-server model.

In Flash Lite, the client endpoint is the mobile device and the other endpoint is composed of a remote IP address / network port pair. After a socket connection has been established, the client device can access a set of services on the server machine without renewing the network access continuously. This results in reliable low-latency network services.

Flash Lite uses the XMLSocket object to allow Flash content to use socket communication. The socket can transfer XML-formatted data as well as plain text.

Note: XMLSocket is supported on S60 devices with Flash Lite 2.1 or newer. Series 40 devices do not support this feature.

There are several considerations regarding XML sockets:

  • The connection is a full-duplex TCP/IP stream, and there is no limit on the amount of XML messages that can be sent over the course of the connection.

  • Port numbers below 1024 are not allowed.

  • The Flash Lite application can only connect to services available from ports in the same domain, unless a cross-domain policy file is used.

For a tutorial on using network sockets with Flash Lite, see Developing multiplayer applications with Flash Lite XMLSockets and Java NIO at the Adobe Developer Connection.