Search code examples
c++telnet

send a CTRL-C over a network


I want to replicate a condition where in if I did a CTRL-C after I connecting to a server using telnet, the server would crash. I want to write a C++ program which does it. What does telnet send over the network when we do a CTRL-C . I read that CTRL-C is '0x03'. Does it send the same thing or does it send something else and how should I send it using a C++ application.


Solution

  • Telnet really does send 0x03. Telnet is just a regular TCP connection with some escape codes that do various things.

    But to test a server over telnet, you probably really want to use the "Expect" utility: http://en.wikipedia.org/wiki/Expect