Connecting to the Server

Once all the client side connection properties have been defined, the application can call the Connect method. This requires the following five parameters:

  1. The URL of the Remote Access server

    Note: The full URL of the Remote Access service on the host system is in the form 'x-<Protocol>:<IP Address><Port Number>', for example, x-ratl:127.0.0.1:2449.

  2. The View name

  3. A reference to the login attributes object

  4. The status line object

  5. The connection mode for connecting to the application

The code to call the connection method is as follows:

Dim mvarURL as String
Dim iResult as Integer
Dim mvarViewName as String

’Build the full URL of the Remote Access server
mvarURL = "x-ratl:" + Trim$(mvarIPAddress) + ":" _
           + Trim$(Str$(mvarPortNo))
’Now set view name to view defined on the host
mvarViewName = "TEST"
’Connect. Set iResult to the result of the connection attempt
iResult = mvarConnection.Connect(mvarURL, mvarViewName, _
                                mvarLoginAttrsRef, mvarStatus, 0)

Once the Connect method has been executed, the application should examine the value of iResult to determine whether the connection was successful or not. A listing of the result codes is contained in “Response Codes” on page 5-8, but typical values at this point are:

Value

Description

100

Successfully connected to the application server and the application.

Note: At this point the system has not sent the first Ispec

101

Successfully connected to the application server but a usercode/password is required to complete the logon process.

Note: At this point the system has not sent the first Ispec

904

The system could not connect to the host system. This is usually the result of an error in the IPAddress or Port number.

906

The connect request timed out.

If the response is 100, the client can continue with connection process and request the fireup Ispec from the application. If the response code is 101, the client must submit a usercode and password before requesting the fireup Ispec.

Note: This is the user code and password required to connect to the application server system (for example, a MARC user code and password). It is not the user code and password required to logon to the application.