Question

I have a project that connects to an AS400 and communicates with a combination of plain text and what appear to be old ANSI escape codes. I have the project to the point where I can receive and send plain text, log in, and log out.

I have been told this thing communicates via the tn5250 protocol, however, other than the ANSI codes I am not seeing any unusual characters from the server.

I can send any plaintext to it just by writing to the socket directly. I must first encode it into a byte array.

  • How do I send (i.e. what bytes are) function keys (F1-F12)?
  • How do I send (i.e. what bytes are) alternate function keys (F13-F24)?
  • How do I send (i.e. what bytes are) special keys (i.e. pagedown / rollup)?

    Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Connect(new IPEndPoint(IPAddress.Parse(IP), 23)); socket.Send(Encoding.ASCII.GetBytes("Plaintext goes here"));

Was it helpful?

Solution

You are connecting using VT emulation.

See the documentation for VTxxx Telnet client sessions for more information.


Note that there is a .NET database provider, as well as 5250 client emulation API's available. See IBM i Access for Windows .NET provider and IBM i Access for Windows : Programming for more information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top