Setting the Terminal device

Dec 1, 2014 at 1:37 PM
Is there a way of me setting which device i'm connecting as? We use a VT100 and when I connect I get a load of text back saying error device not recognized etc.

What im getting back is:

13:32:26: %SET-W-NOTSET, error modifying FTA1880:
13:32:26: -SET-I-UNKTERM, unknown terminal type
13:32:27: [c
13:32:38: %SET-W-NOTSET, error modifying FTA1880:
13:32:38: -SET-I-UNKTERM, unknown terminal type

What im wondering is if I can sort of tell the system im connecting as a VT100?
Dec 1, 2014 at 2:48 PM
Whats your code for connecting to the device?

You can do:
SshClient.CreateShellStream(@"vt100", 80, 24, 800, 600, 1024);
or
SshClient.RunCommand("export TERM=v100 && echo $TERM")
Dec 1, 2014 at 3:05 PM
Im using

stream = OpenVMSDriver.client.CreateShellStream(@"vt100", 80, 24, 800, 600, 1024);

Could I use the .RunCommand before I create the shell stream?
Dec 1, 2014 at 3:16 PM
Or maybe I can call the create steam before I connect?
Dec 1, 2014 at 3:40 PM
Edited Dec 1, 2014 at 3:40 PM
Looks good at my test setup:
            stream = client.CreateShellStream(@"vt100", 80, 24, 800, 600, 1024);
            stream.Write("env | grep TERM\n");
            stream.Write("echo $TERM\n");
=>
# env | grep TERM
TERM=vt100
# echo $TERM
vt100
What does your ENV looks like after creating the shell stream?
Dec 1, 2014 at 4:22 PM
I get this back:
    Last interactive login on Monday, 1-DEC-2014 16:07:13.06
    Last non-interactive login on Monday, 1-DEC-2014 09:18:02.75
System Detective is monitoring activity on this system.
←[c←\←Z←[0c
%SET-W-NOTSET, error modifying FTA1959:
-SET-I-UNKTERM, unknown terminal type
←[c
After using this:
            PasswordAuthenticationMethod authMethod = new PasswordAuthenticationMethod("MyUser", "MyPassword");
            ConnectionInfo connectionInfo = new ConnectionInfo("MyServer", "MyUser", authMethod);
            client = new SshClient(connectionInfo);
            client.Connect();

            stream = client.CreateShellStream(@"vt100", 80, 24, 800, 600, 1024);
            stream.Write("env | grep TERM\n");
            stream.Write("echo $TERM\n");

            reader = new StreamReader(stream);
            Thread.Sleep(15000);
            output = reader.ReadToEnd().Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            foreach(string line in output)
            {
                Console.WriteLine(line);
            }

            Console.Read();
Our system is running OpenVMS
Dec 1, 2014 at 4:45 PM
I tried using the command:
show terminal /full
and I get:
show terminal /full
Terminal: _FTA1968:   Device_Type: VT100         Owner: PAYMENTS1U
   Input:    9600     LFfill:  0      Width:  80      Parity: None
   Output:   9600     CRfill:  0      Page:   24
Terminal Characteristics:
   Interactive        Echo               Type_ahead         No Escape
   Hostsync           TTsync             Lowercase          Tab
   Wrap               Scope              No Remote          No Eightbit
   Broadcast          No Readsync        No Form            Fulldup
   No Modem           No Local_echo      No Autobaud        No Hangup
   No Brdcstmbx       No DMA             No Altypeahd       Set_speed
   No Commsync        Line Editing       Insert editing     No Fallback
   No Dialup          Secure server      No Disconnect      No Pasthru
   No Syspassword     No SIXEL Graphics  No Soft Characters No Printer Port
   Numeric Keypad     ANSI_CRT           No Regis           No Block_mode
   Advanced_video     No Edit_mode       DEC_CRT            No DEC_CRT2
   No DEC_CRT3        No DEC_CRT4        No DEC_CRT5        No Ansi_Color
   VMS Style Input    <CTRL-H> Backspace
The problem is I still get all this stuff before it:
    Last interactive login on Monday, 1-DEC-2014 16:34:37.29
    Last non-interactive login on Monday, 1-DEC-2014 09:18:02.75
System Detective is monitoring activity on this system.
←[c
%SET-W-NOTSET, error modifying FTA1968:
-SET-I-UNKTERM, unknown terminal type
←[c
%SET-W-NOTSET, error modifying FTA1968:
-SET-I-UNKTERM, unknown terminal type
And the problem is its delaying how long it takes to connect. Because it takes a while for it to not recognize the terminal which slows everything down.
Dec 2, 2014 at 6:33 AM
What happens if you switch from "vt100" to "vt220" or "xterm"? The same?

What is the ssh server running on?
Dec 2, 2014 at 8:42 AM
Yeah the exact same thing happens. I did find somewhere on the internet though that the reason for the delay is that OpenVMS is querying for the terminal type, but because it doesnt get a response it times out. If I send:
writer.WriteLine((char)27 + "[?1;1c");
Then it basically exits out of one of the checks but I still get 2 showing. Though it doesnt reduce the time to connect to around 16 seconds from 35. With that line of code I get the following results:
    Last interactive login on Tuesday, 2-DEC-2014 08:36:13.95
    Last non-interactive login on Monday, 1-DEC-2014 09:18:02.75
System Detective is monitoring activity on this system.
←[c←7←[255;255H←[6n←8
%SET-W-NOTSET, error modifying FTA2093:
-SET-I-UNKTERM, unknown terminal type
testdir is COUNTERDEV
Initialising TEST Environment to COUNTERDEV
←[←(0qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
qqq
qq←(B
←[←#3   Using Test Search rules COUNTERDEV   ←[0m
←[←#4   Using Test Search rules COUNTERDEV   ←[0m
←[←(0qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
qqq
qq←(B
←[c
 Automation Test>
So it seems the first time im sending the escape line its not working but I have this in a loop:
                        if(output[i].Contains((char)27 + "[c"))
                        {
                           writer.WriteLine((char)27 + "[?1;1c");
                        }
This seems to get rid of any further of the errors.
Dec 2, 2014 at 8:59 AM
Edited Dec 2, 2014 at 8:59 AM
Hm, maybe you should ask OpenVMS what the heck they are doing :)
Sounds like it is not an issue of SSH.NET, but for all SSH-Clients!?
Do Putty and OpenSSH produce the same errors?
Dec 2, 2014 at 10:12 AM
I found this: http://labs.hoffmanlabs.com/node/1483

Basically OpenVMS is asking "what terminal are you" and theres no response sent back. I need to be able to send:
(char)27 + "[?1;0c"
in the VT100 manual I also found this:

_DA -- Device Attributes
The host requests the VT100 to send a device attributes (DA) control sequence to identify itself by sending the DA control sequence with either no parameter or a parameter of 0.
Response to the request described above (VT100 to host) is generated by the VT100 as a DA control sequence with the numeric parameters as follows:_
Option Present  Sequence Sent
No options  ESC [?1;0c
Processor option (STP)  ESC [?1;1c
Advanced video option (AVO)     ESC [?1;2c
AVO and STP     ESC [?1;3c
Graphics option (GPO)   ESC [?1;4c
GPO and STP     ESC [?1;5c
GPO and AVO     ESC [?1;6c
GPO, STP and AVO    ESC [?1;7c
So I think essentially whats happening is when I connect, Vms is asking what kind of device I am... and I cant find a way of responding.