Building Distributed
Applications
Using the Progress AppServer


Connection Example

The following code example shows how a client application specifies the connection and application arguments to connect an AppServer. The -AppService, -H, and -S parameters are passed as the connection-parameters argument to the CONNECT( ) method. Specific userid and password values are also passed as connection arguments. A value is not supplied for the appserver-info argument.

DEFINE VARIABLE hAppSrv AS HANDLE  NO-UNDO.
DEFINE VARIABLE ret     AS LOGICAL NO-UNDO.

CREATE SERVER hAppSrv.
ret = hAppSrv:CONNECT
  ("-AppService inventory -H zeus -S 5162","SMITH","STARSHIP").
IF NOT ret THEN
  RETURN ERROR "Failed to connect to AppServer".

.
.
.

ret = hAppSrv:DISCONNECT().
DELETE OBJECT hAppSrv. 

This code tries to connect an AppServer that supports the Application Service, inventory. It sends its connection request to a NameServer that runs on a machine with the host name, zeus and is listening on UDP port 5162. When the CONNECT( ) method executes, the last two arguments are passed as the first two parameters to the AppServer Connect procedure. A value of "SMITH" is passed for userid and "STARSHIP" is passed for password. The unknown value (?) is passed for the appserver-info because a value is not supplied for it.

NOTE: The previous code example, and all remaining code examples in this chapter, are presented in simplified form for discussion purposes. In actual practice, you might use the Parameter File (-pf) parameter as the connection-parameters argument and variables to store the userid and password (probably encrypted).


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095