• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet-Applet: raw socket connection

 
Laurent Sate
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic