tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <>
Subject RE: Can Tomcat be used to host socket servers?
Date Wed, 14 Jan 2009 22:21:31 GMT
> From: Jonathan Mast []
> Subject: Re: Can Tomcat be used to host socket servers?
> By socket servers, I mean the existing programs are bound
> to a particular port number and just sit there waiting for
> requests.  The port numbers are arbitrary

How do they get assigned?  When you say the program is listening for a request, does it have
a socket_read or socket_accept up?  (The first is looking for data, the second for a connection

> I'm not knowledgeable enough of networking to know whether
> they use HTTP or not.

That's a rather critical factor to determine whether or not you can simply pass on the request
to a servlet.

> The reason I would have liked Tomcat to handle the whole
> shebang is that now I'll have to adjust each system that
> hosts these sockets to automatically invoke them when they
> restart.  Kinda tedious.

You won't be able to use a stock Tomcat to listen/read on those ports, but you could still
package your socket servers inside a webapp.  A ServletContextListener inside the webapp would
likely have to create a thread for each port of interest, and those threads could connect
with the standar Tomcat port to pass on HTTP-formatted requests.  Your clients would have
to expect HTTP as a response, or your server threads would have to convert the response to
whatever protocol the clients do expect.

You could also write your own Tomcat connector to do the above, rather than a webapp, but
you would then be pretty much tied to a specific level of Tomcat.

 - Chuck

for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message