Is it possible to implement a socket server on Tomcat using a GenericServlet?

I would like to implement a socket server to which several clients will connect. To make the implementation as simple as possible and not need to coordinate flow and connection management, etc., I would like to use Tomcat. We are already using tomcat as part of our solution.

I'm sure Tomcat can be used for non-server servlets and socket connections - with GenericServlet. I would like this to be confirmed and any advice that may be given on implementation.

UPDATE - using tomcat seems like the wrong tactic - little is gained from the rest of the tomcat infrastructure. Has anyone received any other implementation recommendations? For example, Apache MINA is recommended - any others?

+2
java tomcat servlets
Jul 02 '09 at 18:25
source share
1 answer

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 this point, you will mainly get the ability to start and stop Catalina, and not much more.

If you want to place your application in a servlet container, I would suggest a berth of size, ease of use, the ability to run programmatically and the ability to fully enter the debugger.

+1
Jul 02 '09 at 23:58
source share



All Articles