问题描述:

I have problems to send Ctrl+a / Ctrl+q.

I try this:

byte[] buffer = new byte[1];

buffer[0] = 1; //Ctrl+a

sys.WriteChar(buffer);

byte[] buffer1 = new byte[1];

buffer1[0] = 17;//Ctrl+q

sys.WriteChar(buffer1);

and this is my function:

public void WriteChar(byte[] Value)

{

if (!tcpSocket.Connected) return;

tcpSocket.GetStream().Write(Value, 0, 1);

}

public void Write(string cmd)

{

if (!tcpSocket.Connected) return;

byte[] buf = System.Text.ASCIIEncoding.ASCII.GetBytes(cmd.Replace("\0xFF", "\0xFF\0xFF"));

tcpSocket.GetStream().Write(buf, 0, buf.Length);

}

Write() is only for strings, this works well.

But WriteChar() does not work, he does not understand Ctrl-c/a/q...

Does someone see my mistake? Any ideas?

Thank you in advance!

Homeros

网友答案:

Have you tried to use expect byte code "^Q" string?

相关阅读:
Top