Search code examples
flashnode.jsp2pred5rtmfp

Flash Sockets, Peer-to-Peer Capabilities


Quick Intro: We have a flash tetris game finished and we are looking to add multiplayer functionality to the game. After a few days of research on the capabilities of flash and sockets, I've gotten even more confused. A quick disclaimer, I am new to sockets/networking in general.

From what I gathered online, general flash tcp sockets cannot handle peer to peer connections due to the policy system in place. In order for flash to do p2p, one must use a RTMFP-capable server (such as flash media server, etc) to deal with the initial handshakes and from there, flash is able to pass data in a p2p fashion.

Edit: See the first answer for a comprehensive update on the question.


Solution

  • 1) For socket policy take my Perl-script or the Apache module (both work well): http://code.google.com/p/mod-socket-policy/ - it will serve clients connecting to the port 843.

    But this is not enough because of corporate users behind firewalls / proxies - who can't connect to port 843, so you need to add socket policy handling to your own server code too (i.e. respond to incoming <policy-file-request/>\0 requests).

    2) For RTMFP - don't do it, because:

    a) Cirrus is not an option, because it is beta and not for commercial use. Also it seems to be outdated by the FMS4, so how long before it's discontinued?

    b) Flash Media Server 4 option is very expensive. For the enterprise version (required for RTMFP) Adobe doesn't even list the price publicly. Your only option is FMS4 for AWS, but it is expensive too: adobe media server 4 cost with amazon?

    c) There is an OSS project for RTMFP, but it isn't ready yet: OpenRTMFP Cumulus

    d) For some users RTMFP just doesn't work

    So my suggestion is to go with RTMP/RTMPT which works for all users, incl. corporate ones and use Red5 for that: http://red5.org/