Search code examples
stringsocketsconnectiontelnet

How to send string data to socket connection via telnet or any other program?


I am trying to send and receive string data to socket connection via telnet, but I am not able to type or see anything in the telnet window. I am able to connect to the server via telnet, but not able to send the string data.

Is there any other alternate method to send string data over socket connection.


Solution

  • Telnet, unless it negotiates parameters to the contrary, does "remote echo" meaning that you won't see anything you type unless the server echos it back.

    A lot of people use the term "Telnet" when really it is a raw socket connection that does no configuration negotiation upon connect.

    If you're sending data from a file or source other than the keyboard (and even often when sending from the keyboard), you're better of using a program like socket or nc (netcat) which don't attempt to do any processing of the data stream and so provide simple 8-bit clean connections.

    In the case of both those problems, you can simply redirect stdin from a file or echo a string to them through a pipe.