views:

277

answers:

2

Hello all im planning to build flash multilayer server ( in c++ or java ) im not coming from the flash area . But from what im reading flash does support sockets , BUT this is not my case i need to be able to support browser flash games so it leaves me with port 80 with http .but how can i implement good communication architecture with http ( rest ? ) that the flash player supports Thanks

+2  A: 

Hello,

Flash, even from within a browser, does support Socket connections, using the Socket class (in AS3) or the XMLSocket class (AS2/AS3).

But everything depends on what you're planning to do with the application, and how the networking is going to be used. For a multiplayer game, you'd probably need a push-pull network layer (where both the client and the server can send data to each others at any time). A Socket can do that.

Using HTTP would need your client to request data repeatedly to your server, which can be a burden both for maintaining a server-side context (you can't tell when a client is disconnected, and there's a lot of spoofing security issues related to this technique), and for performances, especially if your game is designed to be played in real time.

There is a framework for making AS3/Flex application communicate with a Java server, developed by Adobe : BlazeDS.

Hope this helps.

Tyn
one thing i dont understand is there any way not to use http when im working with browser clients
Both the Socket and XMLSocket classes use TCP and not HTTP.Socket is better if you're writing in AS3.
Eliram
A: 

If you use the Socket or XMLSocket class, make sure your server has a security policy file available. Check this SO question/answer for more info.

zooropa