Previous Topic

Next Topic

StopServerXtd

Stop operation of the c-tree Server, Extended Version

Short Name

STPSRVX()

Type

Server only function

Declaration

COUNT StopServerXtd(pTEXT admnuser, pTEXT usrword,
                      pTEXT servname, COUNT delay)

Description

StopServerXtd() stops operation of the c-tree Server from inside an application. usrword must point to the password of the system administrator, admnuser. servname can point to an optional c-tree Server name, or may be NULL when using the default c-tree Server name.

The application should NOT be connected to the c-tree Server when StopServer() is called. Call RegisterCtree() before and UnRegisterCtree() after the call to StopServer().

A non-zero delay specifies the number of seconds the c-tree Server should delay before beginning the shut down process. The delay allows transactions in process to complete. When a non-zero delay is specified, the c-tree Server does not accept any new users or new transactions while waiting to shut down. Logons and transactions fail with SHUT_ERR (150). After the delay expires, the c-tree Server immediately shuts down. Any users currently logged in are logged off and any incomplete transactions are aborted.

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful allocation.

133

ASKY_ERR

c-tree Server cannot be found. Has it been shut down?

451

LPWD_ERR

Invalid administrator password.

535

REGC_ERR

No c-tree Plus instance registered.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

Example

TEXT      admnuser[10],usrword[10],servname[256];
COUNT     delay=10;

RegisterCtree(MYREGID);
printf("\nEnter the Admin ID: ");
scanf("%10s",admnuser);
printf("\nEnter the password: ");
scanf("%10s",usrword);
printf("\nEnter the server name:");
scanf("%255s",servname);

if (StopServerXtd(admnuser,usrword,servname,delay)
    printf("\nError on StopServerXtd() error = %d",uerr_cod);

UnRegisterCtree(MYREGID);

See also

RegisterCtree(), UnRegisterCtree()