NetLinx Programming
86
NX-Series Controllers - WebConsole & Programming Guide
SSH SEND_COMMANDs
These command open or close SSH communication with a server:
SSH SEND_COMMANDs
SSH_CLIENT_CLOSE Closes an open SSH communication port with a server.
Syntax:
SEND_COMMAND <DEV>,"'SSH_CLIENT_CLOSE(LocalPort)'
Parameters:
• LocalPort - A user-defined (non-zero) integer value representing the local port on the client machine to use for
this conversation. This local port number must be passed to SSH_CLIENT_OPEN to open the conversation.
Returns:
This function always returns 0. Errors are returned via the DATA_EVENT ONERROR method. The following errors
may be returned from the call:
2 - General failure (out of memory)
4 - Unknown host
6 - Connection refused
7 - Connection timed out
8 - Unknown connection error
9 - Already closed
14 - Local port already used
16 - Too many open sockets
Example:
SEND_COMMAND <DEV>,"'SSH_CLIENT_CLOSE(5000)'"
SSH_CLIENT_OPEN Opens a port for SSH communication with a server.
Syntax:
SEND_COMMAND <DEV>,"'SSH_CLIENT_OPEN(LocalPort, ServerAddress, remotePort, username,
password, privateKeyPathname, privateKeyPassphrase)'"
Parameters:
• LocalPort- A user-defined (non-zero) integer value representing the local port on the client machine to use for
this conversation. This local port number must be passed to SSH_CLIENT_CLOSE to close the conversation.
• ServerAddress - A string containing either the IP address (in dotted-quad-notation) or the domain name of the
server to which you want to connect.
• remotePort - The port number on the server that identifies the program or service that the client is requesting,
typically 22
• username - Login user name
• password - Password for the user name, null if using PKI
• privateKeyPathname - Path to private key
• privateKeyPassphrase - Password for private key.
Returns:
This function always returns 0. Errors are returned via the DATA_EVENT ONERROR method. The following errors
may be returned from the call:
2 - General failure (out of memory)
4 - Unknown host
6 - Connection refused
7 - Connection timed out
8 - Unknown connection error
9 - Already closed
14 - Local port already used
16 - Too many open sockets
Example:
SEND_COMMAND <DEV>,"'SSH_CLIENT_OPEN(5000, '192.168.0.1', 22, 'user1', 'password', '/
certs/id_rsa', '')'"