BaseHTTPRequestHandler: how to read/write until diconnected

Maksim Kasimov maksim.kasimov at gmail.com
Thu Jul 13 12:14:41 EDT 2006


Hi,

I'm trying to write an server-application, using BaseHTTPServer/BaseHTTPRequestHandler.

When application is running, some client-application can post data to the server, and BaseHTTPRequestHandler reads all headers and posted raw data from "rfile", sends back response, than client/server session, than session closed - that works just fine.

how to check whether some data posted again by the client in the session, and send response again in one session (and do such iterations util client stops to post data) ?




something like this:

class ServerChannel( BaseHTTPServer.BaseHTTPRequestHandler ):

	def do_POST(self):

		while needReadMessage:
			...
			msg_count += 1
			log.info( "message number %d arrived" % msg_count )
			raw_post_data = self.rfile.read( contentLength )
			...
			self.wfile.write( respContent )


many thanks for help.
	

-- 
Maksim Kasimov



More information about the Python-list mailing list