Powered by QM on a Linux server
Help and Support

KnowledgeBase 00054: Executing Code on a Remote Server

Last updated: 27 Dec 2018
Applies to: All versions
Top level index       Full Index Search Tips
Previous article     Next article

It is sometimes useful for an application on one system to be able to execute a subroutine or a command on another system. The QMBasic interface to the QMClient API makes this easy.

Using QMClient inside a QMBasic Program

There is a class module in the global catalogue named !QMCLIENT that provides the ability for an application to open a connection to a remote QM server, subject to the usual QMClient security rules.

   IF SESSION->CONNECT(servername, port, username, password, account) THEN 

Executing a Subroutine

To execute a subroutine on the remote system, the processing element of the above code fragment becomes

   SESSION->CALL("subrname", arg1, arg2,...) 
Data can be passed in both directions via the arguments in the same way as for other subroutine calls.

Executing a Command

To execute a command on the remote system, the processing element of the above code fragment becomes

   RESPONSE = SESSION->EXECUTE(command, state) 
where the returned value is the output from the command and the state variable indicates the status of the executed command. In particular, this allows the program initiating the command to handle requests for input (see the QM Reference Manual for details).

Related Articles


Please tell us if this article was helpful
Very     Slightly     Not at all
Email (optional)