aspose file tools*
The moose likes Servlets and the fly likes Servlet-Applet: raw socket connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet-Applet: raw socket connection" Watch "Servlet-Applet: raw socket connection" New topic
Author

Servlet-Applet: raw socket connection

Laurent Sate
Greenhorn

Joined: Dec 18, 2001
Posts: 10
Hello,
I must use a raw socket connection to communicate between a applet and a servlet because I want have a permanent connection between them. How Can I do that?
I have seen the DaemonHttpServlet class on http://www.servlets.com/cos/index.html. How I can use it? What do I implement in the HandleClient method? And i my applet, how can i attack my servlet?
Thanks a lot!!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16246
    
  21

You don't do "permanent" connections to servlets. A servlet behaves like a subroutine, not a program. It does not run as a process in its own right, and therefore there would be no way to make it stop and listen (or even poll and listen) for incoming messages.
If you actually need a true permanent connection, you'll have to set up an independent server for that purpose. If all you really needed was for the applet to do internal transactions, an HttpURLConnection makes a lot more sense
As far as persistent connections for the purpose of reducing connection overhead go, most modern-day webservers keep the pipeline open for a certain period of time after a request comes in in anticipation that there will be more traffic.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
 
subject: Servlet-Applet: raw socket connection