En Wed, 27 Feb 2008 10:33:35 -0200, rocksportrocker <[EMAIL PROTECTED]> escribi�:
> Hi, > > I am trying to implement a local server for storing and retrieving > numerical data. > So I use BaseHTTPServer as follows: > > --------------------------------------------------------- > from BaseHTTPServer import * > > class Handler(BaseHTTPRequestHandler): > > def do_POST(self): > > print "POST" > self.send_response(200) > > > httpd = HTTPServer(("",8000), Handler) > httpd.serve_forever() > --------------------------------------------------------- > > For testing I use: > > --------------------------------------------------------- > > import httplib > > > data = "123456789o" * 100 > > conn = httplib.HTTPConnection("localhost:8000") > print conn.request("POST", "/", data) > > --------------------------------------------------------------- > > Executing this client, the server says: > > error(10053, 'Software caused connection abort') > > If I add "conn.getresponse()" at the end of the test script, the > message disapears, but the server hangs. If you don't add that line, the client process exits and drops the connection, and the server detects that situation when it tries to send the response to a dead socket. The server "hangs" because you told it to "serve_forever"; it's waiting for the next request. Use Ctrl-C to stop it. You may find easier to use urllib or urllib2 to write the client. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list