开发者

Tomcat and java.net.ServerSockets

开发者 https://www.devze.com 2023-03-19 04:53 出处:网络
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 soc

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.

0

精彩评论

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