开发者

How to configure java server based on sockets (non http ) with Tomcat

开发者 https://www.devze.com 2023-03-18 12:45 出处:网络
I\'m currently developing a web server based on sockets for a web game. The client will be based on Java applet.

I'm currently developing a web server based on sockets for a web game.

The client will be based on Java applet.

  1. Is it possible to use Apache Tomcat server for this mission?

    If it is possible, could you recommend us a step by step guide for how to configure it?

  2. Do y开发者_Python百科ou think that we should use alternative server for that?

  3. Will it be easier to implement this using servlets (http requests) and Google Application Engine?


I think you have to write your own connector and protocol handler for tomcat if you need another protocol than http.

In this case try Apache Mina.


I don't know anything about Servlets and Tomcat, but you can simply start the server as a standalone Java program, opening a ServerSocket to listen on the port. On each connection, split off a new Thread with will read from the new Connection.

For greater scalability, use nonblocking IO and a selector instead of a separate thread for each connection.

0

精彩评论

暂无评论...
验证码 换一张
取 消