Using XML Socket Connections with Flash 5
Author: stray (email@example.com)
- What are XML Socket Connections with Flash 5?
Flash 5 allows direct socket connections to transfer data back and forth encoded as XML structures through a persistent connection. This has a lot of advantages (less overhead in data transfers, real time applications, etc) but implies a piece of server software (other than just a httpd daemon used for the get/post approach we were limited to in version 4) that is listening to connections on a certain port, handling incoming connections, receiving, decoding, encoding and sending data.
- What do I get on this page?
On this page, you find a stripped down example for a very simple piece of server software, written in perl, that handles incoming connections from a very simple client example in Flash 5 format. You can use this pair of examples as a framework for your own Flash application.
- Aim, support, legalese...
I can't really give you support for either the client or the server part. If you have perl and Flash 5, you should be able to get them to work, if you don't, doing socket stuff with Flash might just not be for you :) ... I actually just put those two example snippets on the net because a couple of guys on the Macromedia news server asked for them.
On the other hand, if you manage to build something useful out of this framework, it would be nice to hear from you. Also, if you're interested in creating game or chat applications using this technology, drop me a line and perhaps we can pool resources ...
- File Downloads
The following files are available for download:
- flash_sockets.tar is a tarball containing the server example in perl and the .fla client example
- basic_server.txt is just the perl code for the server example
- xml_socket.zip is a zip file containing just the .fla client example
- Multi User Framework (games, chat, whatever) [added 12 Jan 02]
Okay, since some of you asked for it, here's a sample framework to broadcast events to all connected flash clients:
- globe.swf is a demo client connecting to the script on my server. However, if the server script happens not to run at the moment, this will not work for you. Roll your own instead (next link)
- globe.tar contains the .fla source for the above client and the globe.pl perl script (i.e. the server). Adapt the .fla and .pl files to your needs (mainly set the server address and port) and you should be ready to ... er ... move coloured balls around a plane.
Last modification: 10/28/2000