logo
Powered by QM on a Rpi server
Home
About OpenQM
Sales and Downloads
Help and Support
About
Login

KnowledgeBase 00054: Executing Code on a Remote Server

Last updated: 22 Jul 2016
Applies to: All versions
Search  
Top level index       Full Index Search Tips
Previous article     Next article

This article was originally published as a Tip of the Week.

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.

   SESSION = OBJECT("!QMCLIENT") 
   IF SESSION->CONNECT(servername, port, username, password, account) THEN 
      ...processing...
      SESSION->DISCONNECT 
   END 


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

None.



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