본문 바로가기

공부방/Flex

Communicating between Flash Player and Adobe AIR with sockets

This article illustrates how to use sockets to communicate between an AIR 2 application and ActionScript code running in Flash Player. The example includes two programs: an Adobe AIR application and a Flash Player application. The Adobe AIR application acts as the server and listens for Transport Control Protocol (TCP) connections on a socket. This application uses the ServerSocket class added in AIR 2. (If you aren't already familiar with the TCP protocol, don't worry. You don't really need to know much about TCP to use sockets.) The client Flash Player application runs in a browser and connects to the AIR server application. The programming tasks this article explores include:

  • Creating a socket server
  • Establishing a socket connection
  • Reading and writing data over a socket connection
  • Serving a socket policy file from an AIR application
  • Using the ActionScript Message Format (AMF) to send objects over a socket
  • Implementing IExternalizable for custom serialization

Application overview

This article illustrates socket communication between AIR and Flash Player. The article discusses two applications, an AIR 2 application that acts as a server and a Flash Player application that acts as the client.

 

본문 보기