views:

485

answers:

1

I would like to implement a socket server that will be connected to by multiple clients. In order to make the implementation as simple as possible and not have to code management of threads and connections etc I'd like to use Tomcat. We already use tomcat as part of our solution.

I am sure that Tomcat can be used for non http servlets and socket connections - with GenericServlet. I'd like this to be confirmed and any tips that can be given about implementations.

UPDATE - using tomcat seems the wrong tactic - little is gained from the rest of tomcat infrastructure. Anyone got other implementation suggestions? For example Apache MINA has been recommended - any others?

+1  A: 

If you want to create support for a non-HTTP server inside tomcat you will need to implement a new protocol handler (see the docs for PoolTcpEndpoint). But at that point you're mostly going to be gaining the Catalina startup and shutdown functionality and not a whole lot else.

If you do want to base your app on a servlet container, I'd suggest jetty for size, ease of use, ability to start programatically and ability to fit completely inside the debugger.

Jherico