Hello,
I'm writing a Telnet Emulator for an application that I am working on. Because of organizational demands, I have to emulate a pre-written Telnet client. I have successfully connected to the server and sent commands. However, I get to a point that the client needs to send key presses. On the telnet client that I need to be emulating, the general processing is as follows:
1. Cursor Displays
2. User presses <<SELECT>> key (select no longer exists, so it is mapped to the "DEL" key)
3. User presses down arrow
4. User presses <<SELECT>> key
Repeat steps 3/4 2 more times, then the user presses enter. The enter key is the easy command.....
Anyways, Here is my code for sending in a WriteLine function:
if (!tcpSocket.Connected) return;
byte[] buf = System.Text.ASCIIEncoding.ASCII.GetBytes(cmd.Replace("\0xFF","\0xFF\0xFF"));
tcpSocket.GetStream().Write(buf, 0, buf.Length);
The commands I'm sending to the Write function to emulate are:
connection.WriteLine("\\\u001F");
connection.WriteLine("\\\u0018");
connection.WriteLine("\\\u001F"); ...
(Broken up because of debugging code). I think the problem may be in the unicode characters I am passing.
From searching the internet, I've found \u0018 is the down arrow key/action, \u001F is Del key (how it's mapped). That's probably where my error is occuring.
Any thoughts? Thanks!