StopServerXtd
Stop operation of the FairCom 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 FairCom Server from inside an application. usrword must point to the password of the system administrator, admnuser. servname can point to an optional FairCom Server name, or may be NULL when using the default FairCom Server name.
The application should NOT be connected to the FairCom 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 FairCom 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 FairCom 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 FairCom Server immediately shuts down. Any users currently logged in are logged off and any incomplete transactions are aborted.
Note: If the Replication Agent is running on a server, replication should be stopped before trying to stop the server. If replication is running when you attempt to stop the server, you will see error 792 (External server shutdown disabled).
Return
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
Successful allocation. |
133 |
ASKY_ERR |
FairCom Server cannot be found. Has it been shut down? |
451 |
LPWD_ERR |
Invalid administrator password. |
535 |
REGC_ERR |
No c-tree instance registered. |
See c-tree Error Codes for a complete listing of valid c-tree 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()