A response code of 101 means that additional information is required to complete the connection process. This additional information is usually in the form of a user code and password, but for Windows Systems, it also includes the Domain name.
If iResult = 101 Then ’Get the login attributes from the reference object. Set mvarLoginAttrs = mvarLoginAttrsRef.GetObject() ’Set login attributes If (mvarHostType = "NT") Or (mvarHostType = "UNIX") Then iResult = mvarLoginAttrs.Set("US", mvarUsercode) iResult = mvarLoginAttrs.Set("PW", mvarPassword) If mvarHostType = "NT" then iResult = mvarLoginAttrs.Set("DO", mvarDomainName) End If Else iResult = mvarLoginAttrs.Set("us", mvarUsercode) iResult = mvarLoginAttrs.Set("pw", mvarPassword) End If end
The case of the login attributes depends on the type of application server being used. In many cases the user knows the type of host being used, but in a generic application it might be useful to determine the host type dynamically. This can be achieved using the following code:
Dim HostTypeNames As Variant Dim objAppState As Object ’Get application state object so we can extract the host type Set objAppState = mvarConnection.GetAppState() ’Get list of valid host type names HostTypeNames = objAppState.Host_Type_Names() ’Save the host type mvarHostType = HostTypeNames(objAppState.getHostType())
The statement that performs the actual login is as follows:
Dim UserCodeRef As Object iResult = mvarConnection.login(mvarLoginAttrs, UserCodeRef, mvarStatus)
At the end of the login process, iResult should be 100. Some systems might require additional login parameters, such as access code, access password, charge code, and expired password. For these additional attributes, the system responds with code 103. Other values generally mean that the connection request has failed.
At this point the client is connected to the server, but has not connected to the application, or requested the initial fireup Ispec.