TipcSrvStop


Name

TipcSrvStop — stop RTserver and possibly more processes

Synopsis

T_BOOL TipcSrvStop(stop_type) 
T_IPC_SRV_STOP_TYPE stop_type; 

Arguments

stop_type — how to stop RTserver (T_IPC_SRV_STOP_NORMAL, T_IPC_SRV_STOP_ALL, T_IPC_SRV_STOP_CLIENTS, or T_IPC_SRV_STOP_SERVERS)

Return Values

TRUE if RTserver was successfully stopped, FALSE otherwise.

For stop types other than T_IPC_SRV_STOP_NORMAL, there is no way to determine if additional clients/servers to which the message was forwarded accepted or rejected the request.

Diagnostics

If TipcSrvStop fails, it returns FALSE and sets the global SmartSockets error to one of:

Description

TipcSrvStop stops RTserver and possibly more processes. TipcSrvStop uses TipcSrvMsgSendRpc to send a SERVER_STOP_CALL message with one field containing stop_type and then waits for RTserver to send back a SERVER_STOP_RESULT message with two fields field containing a status string and a result code. TipcSrvStop prints this status string with TutOut and, if the result is not success, sets the global SmartSockets error to the result code returned by the server.

If stop_type is T_IPC_SRV_STOP_NORMAL, then TipcSrvStop stops only the one RTserver that the RTclient is connected to. The RTclients that are connected to that RTserver continue to run, eventually detect that RTserver has stopped, and try to find or start a new RTserver.

If stop_type is T_IPC_SRV_STOP_ALL, then TipcSrvStop stops the one RTserver that the RTclient is connected to, all RTservers connected to that RTserver, and all RTclients connected to those RTservers. The RTclients are stopped by sending them a CONTROL message (with a destination subject of _all) containing the command quit force.

If stop_type is T_IPC_SRV_STOP_CLIENTS, then TipcSrvStop stops the one RTserver and all RTclients connected to that RTserver. The RTclients are stopped by sending them a CONTROL message (with a destination subject of _all) containing the command quit force.

If stop_type is T_IPC_SRV_STOP_SERVERS, then TipcSrvStop stops the one RTserver and all RTservers connected to that RTserver. The RTclients that are connected to those RTservers continue to run, eventually detect that RTserver has stopped, and try to find or start a new RTserver.

TipcSrvStop may attempt to automatically create a connection to RTserver. If RTclient has a warm connection to RTserver, TipcSrvStop returns FALSE immediately. See TipcSrvCreate on automatic creation of connections and warm connections to RTserver.

For information on the rtserver shell script, see the TIBCO SmartSockets Utilities.

Caution

The SERVER_STOP_CALL message sent from TipcSrvStop will not be executed by RTservers receiving the message if the setting of the RTserver option Enable_Stop_Msgs (default TRUE) is set to FALSE. The return code of TipcSrvStop indicates success or failure only for the primary receiving server.

See Also

TipcSrvCreate, TipcSrvIsRunning, TipcSrvMsgSendRpc; see the TIBCO SmartSockets User’s Guide for information on the rtserver shell script.

Examples

This example creates a connection to RTserver, then stops RTserver and all RTclients connected to that RTserver:

if (!TipcSrvCreate(T_IPC_SRV_CONN_FULL)) { 
  return;  /* error */ 
} 
 
if (!TipcSrvStop(T_IPC_SRV_STOP_CLIENTS)) { 
  return;  /* error */ 
} 

The output from the above fragment would be similar to:

Connecting to project <rtworks> on <_node> RTserver. 
Using local protocol. 
Message from RTserver: Connection established. 
Start subscribing to subject </_workstation1_7050>. 
Sending RTserver stop message. 
Message from RTserver: RTserver and its clients stopping. 

TIBCO SmartSockets™ Application Programming Interface
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com