Hello, Antonis!

On Jun 1, 2010, at 9:46 AM, Antonis Kaklis wrote:

> Hi to all, and since this is my first post, congratulations for the perfect 
> framework.

Thank you :).

> i have the following code

This code has two major, obvious problems:

> class SimpleServer(LineReceiver):  
> 
>     def dataReceived(self, line): 
> 
Here you say "dataReceived" receives a "line" parameter.  But dataReceived does 
not receive lines, it receives *data*, i.e. arbitrary chunks of bytes.  What 
you want to do is write a *line*Received method; you are already using 
LineReceiver, so I assume that's what you were trying to do.

If you fix that, the second problem is that you are creating a new XML parser 
for every line received.  Is that actually what you want to do?  Your message 
has some headers, which you will want to skip, and then the body of the message 
spans multiple lines.

Your "XML message" looks a lot like an HTTP POST (I am assuming the lack of 
spaces after the headers in your example is a typo).  Perhaps you would be 
better off using the built-in HTTP server in twisted.web, rather than trying to 
implement your own wire-level protocol?

Good luck,

-glyph
_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to