C# telnet client如何向server端发送"Ctrl+P"组合键?

vivianfdlpw 2006-03-18 11:05:15
试了很多方法都不行,郁闷死了

telnet server端是通过下面的方式判断的(C写的):

#define Ctrl(c) ( c & 037 )
FILE *fp
int ch
ch=getc(fp)
if(ch==Ctrl('P'))
........

不知道客户端用C#怎么把Ctrl+P发送过去
...全文
308 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
vivianfdlpw 2006-03-20
  • 打赏
  • 举报
回复
ok now,many thanks:)
saucer 2006-03-20
  • 打赏
  • 举报
回复
sorry, Charles Petzold is correct, 037 is 11111, so P & 037 gives you 10000, which is 16, so you can just send

char c = (char)16;

send c or the number 16
vivianfdlpw 2006-03-20
  • 打赏
  • 举报
回复
(xxh) 表示 ASCII 字符 xx,指的是发送字符xx?
vivianfdlpw 2006-03-20
  • 打赏
  • 举报
回复
多谢,我待会试试:)
saucer 2006-03-20
  • 打赏
  • 举报
回复
P = 1010000 <-- the lower bits give you 10H, actually
saucer 2006-03-20
  • 打赏
  • 举报
回复
again

just realize that,

A = 1000001
...
P = 1010000 <-- the lower bits give you 16H, actually
...
Z = 1011010

so the idea is similar, although 037 looks suspicious, because 'P' & 037 is 0
saucer 2006-03-20
  • 打赏
  • 举报
回复
sorry, 11H
saucer 2006-03-20
  • 打赏
  • 举报
回复
according to your server code, the answer seems to send

(YourKey & 037)

but according to Charles Petzold, the control key in combination with a letter key generates ASCII control codes from 01H (Ctrl-A) to 1AH (Ctrl-Z), so for your purpose, try 12H ?
代码蜗牛sky 2006-03-19
  • 打赏
  • 举报
回复
http://www.programsalon.com/detail136953.html

Telnet的客户端c#源码

里面应该由你想要的东西
vivianfdlpw 2006-03-19
  • 打赏
  • 举报
回复
源码我找了很多,都没我想要得的

111,092

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧