> From: "Mladen Turk" <[EMAIL PROTECTED]> > Sent: Wednesday, May 25, 2005 10:08 AM
> Sure all that is in place, but OTOH the http keep-alive connection *can* > be opened for several hours or days. > HTTP/1.1 uses persistent connections by default and you must explicitly > add the 'Connection: close' in the header. > Without that, things like internet radio for example would be a > pure wish :) Keep-Alive is for essentially reusing a connection, but even for something like internet radio, you don't need keep-alive. Typically, transactions time out because there's no activity, not simply because they're open a long time. Simple, most basic example is downloading a large file over HTTP using a slow connection. The basics of the protocol are that you send the length, and then the body. The client reads that and start sucking on the socket. There are other aspects of the HTTP protocol that let you get pieces of files (so called "chunking"), and you CAN use those kinds of things, but you don't have too. You simply have to deal with the issues is you lose your connection. If you don't use the more advanced parts of the protocol, you simply start over with: GET /hugefile.zip HTTP/1.0 But the fact of the matter is that you really shouldn't be using the Servlet API for lower level protocols. You really shouldn't be having a servlet sitting on a socket and feeding it back underneath HTTP. HTTP isn't really a connection protocol, it's a higher level transfer protocol. There are other frameworks that are better suited to implementing lower level protocols and customer socket listeners and handlers and what not for Java. It's a shame, really, because we DO have Servlets AND HttpServlets, as a subclass, implying that you can have other protocols than HTTP, but truth is a lot of assumptions that just happen to fit HTTP bubbled up into the Servlet part of the spec, and not just within the HTTP part of the Servlet spec. For example, you couldn't easily implement FTP on top of a Servlet container. But poke around Jakarta, they have frameworks to make it easier to write socket server application, rather than just HTTP based server applicatons. Conecptually you could do this in tomcat, but it's kind of off the main path of what Tomcat does. Regards, Will Hartung ([EMAIL PROTECTED]) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
