PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Principle
  • How to proceed?
  • Direct sending of commands
  • Dialog with an SSH server
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Communicating with an SSH server
Principle
Secure Shell (SSH) is a secure communication protocol. The exchanged data is secured via encryption keys.
A server can support the secure SSH protocol to receive remote commands.
WINDEV and WEBDEV propose several functions allowing you to connect, start a session, transmit commands to run and retrieve the result of these commands.
The protocol is SSH-2.
Two methods can be used to communicate with an SSH server:
How to proceed?

Direct sending of commands

The direct sending of commands is performed by SSHCommand. The parameters for connecting to the SSH server must be described in an sshSession variable.
Example:
cMySession is sshSession
buffOutput is Buffer
cMySession..Address = "127.0.0.1"
cMySession..Port = 22
cMySession..User = "login"
cMySession..UserPassword = "pass"
nExitCode is int
sOutput is ANSI string
sOutputErr is ANSI string
(nExitCode, sOutput, sOutputErr) = SSHCommand(cMySession, EDT_Command)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
RETURN
END
EDT_ExitCode = nExitCode
EDT_StdOut = UTF8ToString(sOutput)
EDT_StdErr = UTF8ToString(sOutputErr)

Dialog with an SSH server

The dialog with the SSH server is performed by the following functions:
Versions 20 and later
SSHConnectShell
New in version 20
SSHConnectShell
SSHConnectShell
Starts a new SSH session of "Shell" type.
Versions 20 and later
SSHDisconnectShell
New in version 20
SSHDisconnectShell
SSHDisconnectShell
Closes an SSH session that was opened by SSHConnectShell.
Versions 20 and later
SSHRead
New in version 20
SSHRead
SSHRead
Reads the data found on the output buffer of the SSH session.
Versions 20 and later
SSHWrite
New in version 20
SSHWrite
SSHWrite
Writes data into the specified SSH session.
The parameters for connecting to the SSH server must be described in an sshSession variable.
Example:
cMySession is sshSession
cMySession..Address = "127.0.0.1"
cMySession..Port = 22
cMySession..User = "login"
cMySession..UserPassword = "pass"
IF SSHConnectShell(cMySession) THEN
Info("Session started")
bufOutput is Buffer = "data"
SSHWrite(cMySession, bufOutput)
SSHDisconnectShell(cMySession)
END
Minimum required version
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment