ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / SSH functions
  • Principle
  • How to?
  • 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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
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?

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:
SSHConnectShellStarts a new SSH session of "Shell" type.
SSHDisconnectShellCloses an SSH session that was opened by SSHConnectShell.
SSHReadReads the data found on the output buffer of the SSH session.
SSHWriteWrites 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 version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 01/26/2023

Send a report | Local help