How does Flash communicate with services / scripts on servers via AMF?
Data is transferred over a TCP/IP connection. Sometimes an existing HTTP connection is used, and in other cases a new TCP/IP connection is opened for the AMF data. When the HTTP or additional TCP connections are opened, the sockets interface is probably used. The AMF definitely travels over a TCP connection of some sort, and the sockets interface is practically the only way to open such a connection.
The "data" that is transferred consists of ECMA-script (Javascript(tm)) data types such as "integer", "string", "object", and so on.
For a technical specification of how the objects are encoded into binary, Adobe has published a specification: AMF 3.0 Spec at Adobe.com
Generally the way an AMF-using client/server system works is something like this:
- The client displays some user interface and opens a TCP connection to the server.
- The server sends some data to the client, which updates its user interface.
- If the user makes a command, the client sends some data to the server over the TCP connection.
- Continue steps 2-3 until the user exits.
For example, if the user clicks a "send mail" button in the UI, then the client code might do this:
public class UICommandMessage extends my.CmdMsg
{
public function UICommandMessage(action:String, arg: String)
{
this.cmd = action;
this.data = String;
}
}
Then later:
UICommandMessage msg = new UICommandMessage("Button_Press", "Send_Mail");
server_connection.sendMessage(msg);
in the server code, the server is monitoring the connection as well for incoming AMF object. It receives the message, and passes control to an appropriate response function. This is called "dispatching a message".
With more information about what you are trying to accomplish, I could give you more useful details.