Catherine Jung wrote:
>
> There's no reason you shouldn't use a ServerSocket from a servlet
> - you could either set it listening in the init method, or get it
> to start and stop listening by sending it messages through the web
> server (if you don't want the servlet listening all the time).
>
You'd have to be very careful about watching for destroy(),
since it can be called any time there is no thread in the
service() method. That means that if there's no outstanding
request, destroy() and init() could be called in the middle
of your "back door" socket communication.
(The servlet container can load and unload a servlet many
times in the course of the container's lifetime, so a
single servlet could have init() and destroy() called
multiple times)
A safer/simpler architecture might be to have a non-servlet
service that could be started/shutdown based on requests
handled by the servlet.
-cks
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html