How does telnet differ from a raw tcp connection

后端 未结 3 953
悲哀的现实
悲哀的现实 2021-02-05 06:08

I am trying to send commands to a server via a python script. I can see the socket connection being established on the server. But the commands I am sending across , do not seem

相关标签:
3条回答
  • 2021-02-05 06:57

    Keep in mind that Telnet is an application layer protocol while TCP is a transport layer protocol. Telnet uses TCP in order to transmit data. That is a big fundamental difference between Telnet and TCP.

    See: OSI Model wikipedia page

    0 讨论(0)
  • 2021-02-05 07:04

    Telnet is a way of passing control information about the communication channel. It defines line-buffering, character echo, etc, and is done through a series of will/wont/do/dont messages when the connection starts (and, on rare occasions, during the session).

    That's probably not what your server documentation means. Instead, it probably means that you can open a TCP socket to the port using a program like "Telnet" and interact with a command interpreter on the server.

    When the Telnet program connects, it typically listens for these control messages before responding in kind and so will work with TCP/socket connections that don't actually use the telnet protocol, reverting to a simple raw pipe. The server must do all character echo, line buffering, etc.

    So in your case, the server is likely using a raw TCP stream with no telnet escape sequences and thus there is no difference.

    0 讨论(0)
  • 2021-02-05 07:13

    From the Wikipedia page on telnet

    ...User data is interspersed in-band with Telnet control information...

    So, to answer your question, yes, telnet does differ from a raw socket.

    RFC 854 describes the telnet protocol if you want to try implementing it or you could use telnetlib if you'd prefer an existing python client.

    0 讨论(0)
提交回复
热议问题