简体   繁体   English

通过网络发送CTRL-C

[英]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. 我想复制一个条件,如果使用telnet连接到服务器后执行CTRL - C ,服务器将崩溃。 I want to write a C++ program which does it. 我想写一个做到这一点的C ++程序。 What does telnet send over the network when we do a CTRL - C . 当我们执行CTRL - C时,telnet通过网络发送什么内容。 I read that CTRL - C is '0x03'. 我读到CTRL - C为'0x03'。 Does it send the same thing or does it send something else and how should I send it using a C++ application. 它发送相同的东西还是发送其他东西,以及我应该如何使用C ++应用程序发送它。

Telnet really does send 0x03. Telnet确实会发送0x03。 Telnet is just a regular TCP connection with some escape codes that do various things. Telnet只是一个常规的TCP连接,带有一些执行各种操作的转义码。

But to test a server over telnet, you probably really want to use the "Expect" utility: http://en.wikipedia.org/wiki/Expect 但是,要通过telnet测试服务器,您可能真的想使用“期望”实用程序: http : //en.wikipedia.org/wiki/Expect

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM