QMConnect()

QMConnect()

Top  Previous  Next

 

The QMConnect() function establishes a QMClient session.

 

The function arguments are:

 

Hostis the IP address or name of the server system. Use of IPV6 addresses in the C and VB.Net variants of the QMClient API requires that the QMConnectionType() function is used first to enabled IPV6 support.

 

Portis the port number to which connection is to be made. Set this to -1 to use the default QMClient port.

 

UserNameis the user name under which the server process is to run.

 

Passwordis the password for the given UserName.

 

Accountis the name of the QM account to be accessed.

 

 

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().

 

 

hmtoggle_plus1C

 

hmtoggle_plus1VB.Net

 

hmtoggle_plus1QMBasic Class Module

 

hmtoggle_plus1Java

 

hmtoggle_plus1Python

 

 

See also:

QMConnectLocal(), QMDisconnect