ctaShutdown

Shuts down the Natural Access Server (ctdaemon) or the server's host system and restarts the server or the server's host system.

Prototype

DWORD ctaShutdown ( CTAHD ctahd, unsigned action)

Argument

Description

ctahd

Context handle of the server to be shut down. ctahd can be a void context handle.

action

Action to be performed. See the Details section for valid actions.


Return values

Return value

Description

SUCCESS

 

CTAERR_BAD_ARGUMENT

Invalid action.

CTAERR_INVALID_CTAHD

An invalid context handle was passed as an argument to a function, or the context was destroyed by another thread.

CTAERR_NOT_IMPLEMENTED

Function is not available in the execution mode associated with the specified context.

CTAERR_NOT_INITIALIZED

Natural Access is not initialized. Call ctaInitialize first.

CTAERR_SVR_COMM

Server communication error.


Details

ctaShutdown shuts down the Natural Access Server (ctdaemon) or the server's host system and restarts the server or the server's host system. action can be the following values:

Value

Description

CTA_SERVER_RESTART

Restarts the Natural Access Server (ctdaemon).

CTA_SERVER_SHUTDOWN

Shuts down the Natural Access Server (ctdaemon).

CTA_SYSTEM_SHUTDOWN

Shuts down the server's host system.

CTA_SYSTEM_REBOOT

Reboots the server's host system.


Example

int DemoShutdown(char* servername)

{
         DWORD ret;
     
         ret = ctaSetDefaultServer(servername);
         if ( ret != SUCCESS )
            return ret;

         // Create void context on default server
         CTAHD ctahd;
         ret = ctaCreateContext(NULL_CTAQUEUEHD,0,NULL,&ctahd);
         if ( ret != SUCCESS )
            return ret;
     
         // Shutdown Natural Access Server
         ret = ctaShutdown(ctahd,CTA_SERVER_SHUTDOWN);

         return ret;
}