Nouk, Dou you forget that APE offer a server-side Javascript API ? :) You don't need to write a C module to listen a port.
Look at : http://www.ape-project.org/wiki/index.php/How_to_build_a_serverside_JS_module#Server You can just listen a port with a server JS module and manage APE events/cmd/raw. Anthony nouknouk a écrit : > Hi, > > I've got one more question about communication between my game server > (a 'classical' Java J2SE application) and the APE server that will run > on the same host. > > As I will use the APE server as kind of 'frontend' to manage users and > lobbys, the APE server and my game server will have to communicate in > both ways. Two examples: > - when a new user connects to the APE server, a callback should be > called in my (Java) game server. > - when a new game is created by my (Java) game server, it will use the > APE server to send a RAW to connected clients. > > For that I see yet 3 possibilities: > > 1/ make my Java game server act as any APE client, and connect to the > APE server with HTTP requests. In other words, it means re-write an > equivalent to the APE JSF in Java and include it in the game server. > > 2/ Write an APE server-side module in C that would open a (local) > listening TCP socket on which my Java game sever will connect. With a > tiny home-made protocol, i will be able to communicate in both ways. > > 3/ Write an APE server-side module in C that will be directly > accessible to my Java game server using JNI (Java Native Interface). > > As far as I tought to it: > > I don't like solution 1, because that means a complete rewrite of kind > of APE client in Java (lot's of code), and I will have to maintain > lot's of things each time a new version of APE server makes changes in > the JSF. > > I'm afraid with a C module with a socket (solution 2), because of > threading issues: my socket will have its own thread ; what will > happend if the socket thread fires an event while the APE server is > doing something else at the same time. I suppose server-side module > framework of APE server is not intended by default to be thread safe. > Moreover, it means an implementation of a complete protocol in both C > module and in my Java server (lot's of code) > > Solution 3 looks the more 'efficient' : the server C module would only > be kind of abstract wrapper interface (ie almost just C prototypes, no > code) to the native module APE functions, and all my specific code > will be in my Java server. But there's still the threading issue (game > server and APE server are in two separate thread) and as I never used > JNI before, I don't know if it is easily doable (especially sharing > the same library between two separate processes). > > Would anyone have an idea ... and good advices ? > > Best regards, > > Nouk² > > -- You received this message because you are subscribed to the Google Groups "APE Project" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ape-project?hl=en --- APE Project (Ajax Push Engine) Official website : http://www.ape-project.org/ Git Hub : http://github.com/APE-Project/
