Putty and telnet newline
Posted: Tue Jun 19, 2012 7:13 pm
So i'm writing a basic telnet server which aims to emulate an IRC like chatroom. It works flawlessly on Linux terminals such as gnome and xterm, but when you try to connect through the common windows telnet client, Putty, it kind of breaks the room. It sends a blank message at the end of 80% of the lines in putty. So if i set my nick to "Matt" and tried to type "Hello" all of the other clients would recieve:
Matt: Hello
Matt:
I've tried catching the blank message and stopping it from sending to every client about 100 different ways but i cant seem to do it, I tried catching:
"\n", "^M", "<CR>", "^[[M", "\^[[M", "\[[M", "\n\r", " ", and a lot more unconventional ways.
The strings I listed above are all of the conventional ways I imagined putty could send a blank/new line. However none of them solve the problem. Its beginnning to become a real headache because I can't start on my MUD until I fix this pretty major glitch, because if someone tries to enter the command , say look. It will send the contents of the room you are in but it will also send an "Invalid command" style thing because putty also sent a blank/empty line after the command.
I thought it was pretty funny though when I SSH'd to my VPS on putty and then telnetted to the server, it worked fine and it was still basically through putty haha. So it is a glitch with the way putty sends newlines i think.
Here is the source code for it, again it works flawlessly on gnome/xterm terminals: http://codepad.org/PzjGAMbU
It is written in Python 2.7.2
Matt: Hello
Matt:
I've tried catching the blank message and stopping it from sending to every client about 100 different ways but i cant seem to do it, I tried catching:
"\n", "^M", "<CR>", "^[[M", "\^[[M", "\[[M", "\n\r", " ", and a lot more unconventional ways.
The strings I listed above are all of the conventional ways I imagined putty could send a blank/new line. However none of them solve the problem. Its beginnning to become a real headache because I can't start on my MUD until I fix this pretty major glitch, because if someone tries to enter the command , say look. It will send the contents of the room you are in but it will also send an "Invalid command" style thing because putty also sent a blank/empty line after the command.
I thought it was pretty funny though when I SSH'd to my VPS on putty and then telnetted to the server, it worked fine and it was still basically through putty haha. So it is a glitch with the way putty sends newlines i think.
Here is the source code for it, again it works flawlessly on gnome/xterm terminals: http://codepad.org/PzjGAMbU
It is written in Python 2.7.2