[Twisted-Python] twisted, nc and LineReceiver

Hello, it's me again ;o) So there's this server I'm porting from a ForkingTCPServer to twisted. It listens on a socket, and reads one line at a time, processes the line and writes the answer back on the socket to the client. The ForkingTCPServer version uses a handler deriving from StreamRequestHandler, and gets the data with self.rfile.readline(). The twisted version uses a LineReceiver protocol. Now, if I use telnet to connect to both version of the server, I can type some data, press return and get the answer back. This is great. However, if I use nc send the data, the twisted-based server sees nothing (lineReceived is not called!) I have to admit I'm baffled, and I'll take any idea. -- Alexandre

On Wed, 6 Nov 2002 19:11:52 +0100, Alexandre Fayolle <alexandre.fayolle@free.fr> wrote:
Sounds like a CRLF versus CR issue. Have you checked for that? :-) -- | <`'> | Glyph Lefkowitz: Traveling Sorcerer | | < _/ > | Lead Developer, the Twisted project | | < ___/ > | http://www.twistedmatrix.com |

On Wed, Nov 06, 2002 at 12:27:52PM -0600, Glyph Lefkowitz wrote:
Indeed. Netcat sends only \n, not \r. See the `delimiter' attribute of the LineReceiver class. -- Christopher Armstrong << radix@twistedmatrix.com >> http://twistedmatrix.com/users/radix.twistd/

On Thu, Nov 07, 2002 at 09:15:11AM +0100, Alexandre Fayolle wrote:
I've committed a more epydoc-friendly patch to add this information to the docstring (using @ivar). Thanks for the inspiration, though ;-) -- Christopher Armstrong << radix@twistedmatrix.com >> http://twistedmatrix.com/users/radix.twistd/

On Wed, 6 Nov 2002 19:11:52 +0100, Alexandre Fayolle <alexandre.fayolle@free.fr> wrote:
Sounds like a CRLF versus CR issue. Have you checked for that? :-) -- | <`'> | Glyph Lefkowitz: Traveling Sorcerer | | < _/ > | Lead Developer, the Twisted project | | < ___/ > | http://www.twistedmatrix.com |

On Wed, Nov 06, 2002 at 12:27:52PM -0600, Glyph Lefkowitz wrote:
Indeed. Netcat sends only \n, not \r. See the `delimiter' attribute of the LineReceiver class. -- Christopher Armstrong << radix@twistedmatrix.com >> http://twistedmatrix.com/users/radix.twistd/

On Thu, Nov 07, 2002 at 09:15:11AM +0100, Alexandre Fayolle wrote:
I've committed a more epydoc-friendly patch to add this information to the docstring (using @ivar). Thanks for the inspiration, though ;-) -- Christopher Armstrong << radix@twistedmatrix.com >> http://twistedmatrix.com/users/radix.twistd/
participants (3)
-
Alexandre Fayolle
-
Christopher Armstrong
-
Glyph Lefkowitz