sockets - AIR server connections -


i wanting give small gaming community. idea make app acts chat client connect game servers. trying grasp concepts on how connections work through examples i've found on web, since self taught seeing examples.

so far examples found connections on same network. need kind of example allow me connect different networks or @ least explanation on need do. need able around router without setting port forwarding on router.

in end app connecting game developer's server need working app before permission connect servers.

any appreciated. if additional information needed ask , i'll best fill in gaps.

that broad question, try give information possible point of view. i'm not yet sure if want have p2p connection (game-application game-application) or standard server model, mentioned different approaches problem.

adobe has support p2p since long time. read faq, esspecially "how rtmfp differ rtmp?" (i try choose sources infographics, helped me understand it).

what should start playing , making first steps in, should netconnection. basic function allow communicate server running e.g. php or connecting flash media server (fms). fms inpartcular interresting you, boosts ideas game do, setting fms not easy,to host own instance more complex. if come conclusion want travel road of using fms, can suggest onyx server. marketing theirself streaming service, in reality access fms ok'ish price (fms instances on amazon way worst last time checked). fms basicly flash as2 file commands. fms can handle real-time (!) persistent connections (!) client connects it. able connect server @ first, , can choose in fms script client have bring table stay on server or rejected. after that, have string tool game. example, have game instance connect it, tell server enemy hit , server near-instantly (the speed amazing, there no feeled delay, instant. called sharedobjects) pass information down enemy game instance. used fms 1 project , long ride understand , work it, nice experience, code server in "same" language game (as2, as3 = ecma).

if dont want spend money @ stage, can use adobe rtmfp instance @ p2p.rtmfp.net. is, far know, testing , rejected if misuse service real project, starting , testing do. if use cirrus engine, can follow this tutorial. find sample code in there:

// cirrus connect info  private const server:string = "rtmfp://p2p.rtmfp.net/";  private const devkey:string = "{your_developer_key}";   // used connect cirrus service private var _netconnection:netconnection;   _netconnection = new netconnection();   // listen status info  _netconnection.addeventlistener( netstatusevent.net_status, onnetstatus );   // connect cirrus using our unique uri  _netconnection.connect( server + devkey ); 

my adive be: try getting comfortable netconnection. straight forward. when first started using it, had couple of days struggeling , reading lot on web, learned lot doing so. should too. use netconnection , try create 2 simple as3/fla instances of code both connect same domain (use adobe rtmfp domain now) , try exchange simple string-data between these instances.

to take of pain of shoulders, add minimum amount of listeners netconnection so:

//main netconnector nc = new netconnection();  //troubleshooting listener nc.addeventlistener(securityerrorevent.security_error, securityerrorhandler); nc.addeventlistener(netstatusevent.net_status, status_handler); //nc.objectencoding = objectencoding.amf0; //default nc.client = this; nc.connect("https://some-domain");  //////////////////////////////////////////////////////////////////////////////// /// call error listener ////////////////////////////////////////////////////////////////////////////////  private function status_handler(e:netstatusevent):void {     //trace("netstatusevent");     dispatchevent(new callevent(callevent.call_native_net_status, e, true ));  }  private function securityerrorhandler(e:securityerrorevent):void {     //trace("securityerrorevent");     dispatchevent(new callevent(callevent.call_native_security_error, e, true ));  } 

you alot of errors , netstatus , netsecuriy events. flash run sandbox-violation errors when know doing. can frustrating if keep up, google every error , compare implementations implementation of others, wrap head around , can neat stuff it.

i recommend google sources , tutorials netconnection , stick 1 on level of knowledge.

good luck.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -