[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.

On Wed, 6 Nov 2002 19:11:52 +0100, Alexandre Fayolle alexandre.fayolle@free.fr wrote:
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!)
Sounds like a CRLF versus CR issue. Have you checked for that? :-)

On Wed, Nov 06, 2002 at 12:27:52PM -0600, Glyph Lefkowitz wrote:
On Wed, 6 Nov 2002 19:11:52 +0100, Alexandre Fayolle alexandre.fayolle@free.fr wrote:
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!)
Sounds like a CRLF versus CR issue. Have you checked for that? :-)
Indeed. Netcat sends only \n, not \r. See the `delimiter' attribute of the LineReceiver class.

Sounds like a CRLF versus CR issue. Have you checked for that? :-)
Indeed. Netcat sends only \n, not \r. See the `delimiter' attribute of the LineReceiver class.
Ahaaa!
Thanks for the quick answer. I've attached a patchlet adding this little piece of information to the LineReceiver's docstring, so that the epydoc documentation will provide the tip.

On Thu, Nov 07, 2002 at 09:15:11AM +0100, Alexandre Fayolle wrote:
Sounds like a CRLF versus CR issue. Have you checked for that? :-)
Indeed. Netcat sends only \n, not \r. See the `delimiter' attribute of the LineReceiver class.
Ahaaa!
Thanks for the quick answer. I've attached a patchlet adding this little piece of information to the LineReceiver's docstring, so that the epydoc documentation will provide the tip.
I've committed a more epydoc-friendly patch to add this information to the docstring (using @ivar). Thanks for the inspiration, though ;-)
participants (3)
-
Alexandre Fayolle
-
Christopher Armstrong
-
Glyph Lefkowitz