On May 28, 3:23 pm, Stefan Behnel <stefan...@behnel.de> wrote: > 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#xmltreebuil... > > > 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
Stefan first of all thank you for your response. I don't want anything fancy. Just a simple server that accepts xml messages from multple clients in xml, parses the XML and show it in a console. Antonis -- http://mail.python.org/mailman/listinfo/python-list