Tomcat and java.net.ServerSockets
Is there anything, what can block me using the java.net.ServerSockets
on the Tomcat
server? 开发者_Go百科As i understand it, the Tomcat is used mainly for http based communication servlet, but raw sockets can be used as well, right?
Regards, STeN
If you are referring to inside the scope of a Servlet then that's definitely asking for trouble. Threads in Tomcat are recycled and this will basically block other requests from using your thread (at least until your thread's request times out). You can, of course create a new thread and bind it to a port (if your Tomcat user has permissions) outside of the request/response cycle but you may want to look into creating a custom Tomcat connector instead.
精彩评论