ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / SSH functions
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
Sends a command to an SSH server. The session is automatically started and closed as soon as the command is sent.
Example
cMaSession is sshSession
cMaSession.Address = "127.0.0.1"
cMaSession.Port = 22
cMaSession.User = "login"
cMaSession.UserPassword = "pass"
nExitCode is int
sSortie is string ANSI
sSortieErr is string ANSI
(nExitCode, sSortie, sSortieErr) = SSHCommand(cMaSession, SAI_Commande)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
RETURN
END
SAI_ExitCode = nExitCode
SAI_StdOut = UTF8ToString(sSortie)
SAI_StdErr = UTF8ToString(sSortieErr)
cMaSession is sshSession
cMaSession.Address = "127.0.0.1"
cMaSession.User = "login"
cMaSession.UserPassword = "pass"

bufDonnéesEnvoyées is Buffer = `Il est [%HeureVersChaîne(HeureSys, "HH:mm:SS")%]`
nExitCode is int
sSortie is string ANSI
sSortieErr is string ANSI

// Exécution d'une script Linux qui stocke les données envoyées dans un fichier 
// puis qui affiche le contenu du fichier sur la sortie standard
(nExitCode, sSortie, sSortieErr) = SSHCommand(cMaSession, ...
"echo $(</dev/stdin) > donnees_envoyees.txt; cat donnees_envoyees.txt", bufDonnéesEnvoyées)
Trace(sSortie) //Affiche le contenu du buffer bufEntréeStandard
Syntax
(<Result>, <Data received>, <Data if error>) = SSHCommand(<SSH session> , <Order> [, <Data to send>])
<Result>: entier
Exit code of the command.
<Data received>: Buffer
Data received from the server.
<Data if error>: Buffer
Data received from the server if an error occurs.
<SSH session>: sshSession variable
Name of sshSession variable corresponding to the SSH session on which the command must be run.
<Order>: Character string
Command that must be sent to the SSH server.
<Data to send>: Optional buffer
Data that must be sent to the server. This data can be read from the standard input (stdin).
Business / UI classification: Business Logic
Component: wd290com.dll
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 10/27/2023

Send a report | Local help