Telnet linebreaks

Patrick M. Nielsen thirsteh at gmail.com
Tue May 23 18:48:08 EDT 2006


Hey guys.

I have begun playing with the Simple MUD server example from the Stackless
website
( http://www.stackless.com/Members/rmtew/code/mud.py )
and it's all good so far, however, I've come to notice something that I
remember from back
in the days (some old mud code), but I don't remember what I did to fix it.

While the MUD reads lines from Telnet clients just fine, clients such as
Gmud are practically ignored,
probably because Gmud doesn't send Telnet-valid data ('\x08'?).

However, a MUD that is not accessible to one such client or others isn't
much good, so I'd appreciate
some help in pinpointing the problem.

These are the code blocks that need modification (I believe)

    def read(self): # TELNET
        ret = self.readChannel.receive()
        if self.echo:
            if ret == '\x08':
                self.send(ret+" ")
            self.send(ret)
        return ret

    def readline(self): # TELNET
        buf = self.readBuffer

        while True:
            if buf.find('\r\n') > -1: # MUD clients that aren't using the
telnet protocol
                i = buf.index('\r\n') # need to be able to do stuff.
                ret = buf[:i+2]
                self.readBuffer = buf[i+2:]
                while '\x08' in ret:
                    i = ret.index('\x08')
                    if i == 0:
                        ret = ret[1:]
                    else:
                        ret = ret[:i-1]+ret[i+1:]
                return ret

            buf += self.read()

I'm suspecting that Gmud doesn't send '\x08', since from looking at some old
DIKU code,
I see that the if '\n' || '\r' are there as well, but there is no check for
'\x08'. If this is indeed
the cause of my problem, how would I go about doing it?

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060524/60da9203/attachment.html>


More information about the Python-list mailing list