The QMConnect() function establishes a QMClient session.
The function arguments are:
The QMConnect() function attempts to establish a QMClient process on the system identified by the Host argument. If successful, the function returns True. If unsuccessful, the function returns False and the QMError() function can be used to retrieve a text error message identifying the cause of the failure.
Host can reference the local machine. For an alternative method of starting a local QM session, see the QMConnectLocal() function.
A single client may open multiple connections simultaneously. For the C and VB.Net variants of QMClient, the internal session number associated with the session opened by QMConnect() can be retrieved using QMGetSession(). All subsequent QMClient function calls relate to the most recently opened session unless QMSetSession() is used to select an alternative session. For the QMBasic class module, Java and Python variants of QMClient, each session is instantiated as a separate object.
QMClient sessions run the MASTER.LOGIN and/or LOGIN paragraph (if present). A QMClient session can be recognised within these paragraphs by testing the value of @TTY which will be "vbsrvr" for QMClient. Note that a prompt for input within the actions performed by the paragraph cannot be handled via QMClient.
The program fragments in the examples below attempt to connect to the server identified by Host, using login credentials in UserName, Password and Account. If unsuccessful, an error message is displayed including the text returned by QMError().