views:

39

answers:

2

I created a java application a year ago which is basically a multithread socket server for a website. I built this around a tutorial, which I expanded to do many things, including live multiplayer game with Flash client. The tutorial I used is the following (in french): http://defaut.developpez.com/tutoriel/java/serveur/multithread/

It's not exactly like the tutorial because I customized every part of it to include the game part and many other things (configuration, debug, etc), but the socket "opening" part is about the same as in the tutorial.

Anyway... For now it's working great. The java application (a .jar file) is running on my dedicated server as a daemon (using "java -jar file.jar &" command inside a .sh script). But for some technical and personal reason, I won't be able to do this anymore because I need to move to a more cheaper hosting solution. (Basically, I was sharing the server with some friends, but...) Everywhere I looked, the only hosting solutions I can find is services offering Tomcat or similar solutions.

Moreover, I looked a lot on Google today, but I don't quite understand how to load my application in Tomcat (if it's even possible) without having to rewrite everything again. I'm also in the dark as if there are hosting plan, other than dedicated or virtual dedicated, which allow me to proceed as I used to do.

Could someone point me to a site explaining how I could implement my existing .jar inside Tomcat (or similar)? Or if someone have another solution to offer me....?

Thank you

+1  A: 

Your game is using raw sockets, which means your own port and protocol to make it run.

Tomcat means the server port and HTTP.

You'd have to rewrite your game as one or more servlets to work over HTTP and deploy on Tomcat.

duffymo
Could you (or someone else) point me to an example code or tutorial? I'm still lost.... Thanks!
Louis Charette
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html
duffymo
A: 

I would recommend getting your head around J2EE and Servlets etc. first,

Head First Servlet & JSP is a good book for that.

After that you should know exactly how to migrate and how to best do it, thread implications etc.

You might also notice that staying with your socket app will be best.

Koekiebox