kak...@gmail.com, 28.05.2010 13:50:
Hi in the following code

class MyClientHandler(SocketServer.BaseRequestHandler):
     def handle(self):
         print self.client_address, now( )
         time.sleep(5)
         while True:
             xmltxt = self.request.recv(1024)<--is this ok -
enough?

Depends. If your messages are never larger than 1K, this is enough. Otherwise, you have to collect the data, instead of parsing each chunk separately.

I suggest using the incremental parser in xml.etree.ElementTree, which allows you to push more data into the parser as it comes in. When done, call it's .close() method to retrieve the result.

http://docs.python.org/library/xml.etree.elementtree.html#xmltreebuilder-objects


I want to send XML messages from my client. The server sends back the
XML it receives but the parser exits with error codes.

You should also rethink your approach one more time. Are you sure that a raw socket is a good protocol for sending your messages? In many cases, a proper higher-level transport protocol like HTTP is much better suited. If you provide more details about what you are trying to do, others may be able to help you further.

Stefan

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to