Dart Home | PowerTCP Emulation for .NET | Custom Development | Reply | PowerTCP Emulation for .NET Topics | Forums |
Author | Forum: PowerTCP Emulation for .NET Topic: Set environment variable on server |
Gayle From: USA Posts: 5 Member Since: 06/13/12 |
posted November 13, 2014 1:10 PM Is there a way for me to set an environment variable on the server when instantiating a telnet session so that my application can determine if Dart is the emulator being used for the connection? |
Jason Farrar (Admin) From: Oneida, NY USA Posts: 223 Member Since: 07/24/07 Extra Support Options Custom Application Development |
posted November 20, 2014 12:44 PM Probably the easiest way to accomplish this would be to set the terminal type environment variable. We already do this with a default of tty. You can change that to something custom adding the following code before calling connect or login: //Create a byte list to hold the terminal type. List<byte> clientVar = new List<byte>(); //Add a null byte (equates to IS in the protocol for option negotiaions) clientVar.Add(0); //Add a string for the terminal type. clientVar.AddRange(System.Text.ASCIIEncoding.ASCII.GetBytes("tty-Dart")); //Terminal Type is one of the already pre-populated options and defaults to "tty", retrieve it from the collection. Option term = telnet1.ClientOptions.Find(OptionCode.TerminalType); //Set the subOption to the terminal type we want. term.SubOption = clientVar.ToArray(); Then call connect and login. If you're connecting to *nix system you can use the printenv command to verify that the TERM environment variable was changed to the provided value. You can use SET to verify on a Windows machine but Windows telnet servers tend not to accept custom terminal types. |
Gayle From: USA Posts: 5 Member Since: 06/13/12 |
posted November 25, 2014 2:19 PM I was able to accomplish this by coming up with a customer escape sequence that is only understandable by the Dart emulator. The escape sequence only replies back if it is "my" emulator. This then allows me to extend capabilities that are only available if running under the Dart emulator. |
Gayle From: USA Posts: 5 Member Since: 06/13/12 |
posted November 25, 2014 2:20 PM I was able to accomplish this by coming up with a custom escape sequence that is only understandable by the Dart emulator. The escape sequence only replies back if it is "my" emulator. This then allows me to extend capabilities that are only available if running under the Dart emulator. |
Reply | PowerTCP Emulation for .NET Topics | Forums |
This site is powered by PowerTCP WebServer for ActiveX |