Enter search terms or a module, class or function name.
This page describes how to setup the Socket example application for PyAMF.
The Socket class in Actionscript 3.0 enables Adobe Flash Player applications to make socket connections and to read and write raw binary data.
A live demo can be found on the PyAMF blog.
Clone the PyAMF repository with:
git clone git://github.com/hydralabs/pyamf.git pyamf cd doc/tutorials/examples/actionscript/socket-example
Alternatively, if you just want to take a look at the source, you can browse the example online.
Note: Make sure you have Twisted >= 2.5 installed.
The Twisted socket server for the Adobe Flash Player and Python AMF clients starts on http://localhost:8000 when you run:
twistd -noy timer.tac
You should see something like:
2008-01-07 06:03:09+0100 [-] Log opened. 2008-01-07 06:03:09+0100 [-] twistd 2.5.0 (../Python 2.5.1) starting up 2008-01-07 06:03:09+0100 [-] reactor class: <class 'twisted.internet.selectreactor.SelectReactor'> 2008-01-07 06:03:09+0100 [-] server.TimerFactory starting on 8000 2008-01-07 06:03:09+0100 [-] Starting factory <server.TimerFactory instance at 0x1414af8>
You can stop the server by pressing Ctrl-c.
If you want to run the application as a Twisted daemon process, use this command instead:
twistd -oy timer.tac
Use the ‘Start’ and ‘Stop’ buttons to control the Python socket server that sends the system time to the Flex application every second:
The Python AMF client can be started by running the following from the python folder:
The client will connect to the socket server on http://localhost:8000 and start sending messages:
Connecting to socket server on localhost:8000 Connected to server. send request: start 2009-07-02 23:06:31.684023 2009-07-02 23:06:32.684465 2009-07-02 23:06:33.684923 2009-07-02 23:06:34.685351 2009-07-02 23:06:35.685828 2009-07-02 23:06:36.686253 send request: stop