Odd Behavior when Connecting to my Program

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 01:34:28

问题


I'm using Twisted to implement a server, of sorts. When I test it, the first line it receives is always strange:

Starting Server...
New connection from  192.168.1.140
192.168.1.140: ÿûÿû ÿûÿû'ÿýÿûÿý\NAME Blurr
192.168.1.140: \NAME Blurr

(for both inputs I sent \NAME Blurr.)

This is the code that prints the input:

def lineReceived(self, line):
    print "{0}: {1}".format(self.name, line)

I'm connecting via Putty through Telnet to a remote host. Is this a telnet protocol I'm missing, or what? When I use Unix's telnet program and connect locally, the first line is fine.


回答1:


You can find an explanation of the "ÿûÿû mystery" here. Short form: telnet is not a simple protocol, and what you're seeing is a trace of a telnet negotiation (trying to) occur with a server that doesn't speak "telnettese";-). Good guess about "is this a telnet protocol I'm missing";-)

The RFCs involved in defining the telnet protocol are linked from this page, if you want to debug further. I'm no putty expert so I don't know how to tell putty to avoid this negotiation (and act like the good old simple Unix telnet client;-).




回答2:


It was indeed a telnet protocol I was missing. Connecting as Raw instead Telnet solved the problem.



来源:https://stackoverflow.com/questions/3208993/odd-behavior-when-connecting-to-my-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!