Python Telnet formatting?

Grant Edwards grante at visi.com
Sun Mar 2 10:25:49 EST 2008


On 2008-03-02, mentaltruckdriver at gmail.com <mentaltruckdriver at gmail.com> wrote:

> I posted here a couple days ago looking for some help creating
> a Telnet-based chat server. You guys pointed me to Twisted,
> which has solved most of my issues.

And we told you that you needed to implement the telnet protocol.

> The issue is, when I use clients like PuTTY, it returns a lot
> of what appears to be formatting (e.g. if I typed Hello, it
> would return "\xff \xfb\x1f\xff\
> xfb\xff\xfb\x18\xff\xfb'\xff\xfd\x01\xff\xfb\x03\xff\xfd\x03Hello".)

That "stuff" that you call "formatting" are commands for the
telnet protocol.  Apparently you've ignored what I told you
about implementing the telnet protocol (or using something that
does).

> How would I go about filtering this stuff out of the strings?

Once again:  If you're trying to write a telnet server, you
need to implement the telnet protocol.

> The thing is too, if I use other Telnet programs like
> Microsoft Telnet, they don't have this formatting,

Different telnet clients act a little differently.  Some won't
try to negotiate with the tenlet server until the server starts
the negotiation.

> so I want to be able to recognize if it does have this
> formatting and act based on if it does or if it doesn't.

You have to handle the telnet protocol if you want to talk to
telnet clients.

-- 
Grant Edwards                   grante             Yow!  Yow! Those people
                                  at               look exactly like Donnie
                               visi.com            and Marie Osmond!!



More information about the Python-list mailing list