TipcSrvConnMsgSend publish (send) a message through the connection
T_BOOL TipcSrvConnMsgSend(srv
,msg
,check_server_msg_send
) T_IPC_SRVsrv
; T_IPC_MSGmsg
; T_BOOLcheck_server_msg_send
;
srv
connection handle to RTserver
msg
message to send
check_server_msg_send
whether or not to check the option Server_Msg_Send first
TRUE
if msg
was successfully sent, FALSE
otherwise.
If TipcSrvConnMsgSend fails, it returns FALSE
and sets the global SmartSockets error number to one of:
msg
or srv
was null, or the destination of msg
was nullmsg
was not a valid messagecheck_server_msg_send
was not TRUE
or FALSE
, or the destination of msg
is not a valid subject
TipcSrvConnMsgSend sends a message for publish-subscribe through the connection to RTserver by calling TipcConnMsgSend. If check_server_msg_send
is TRUE
and the option Server_Msg_Send is FALSE
, then TipcSrvConnMsgSend does not send the message, but returns TRUE
immediately. Otherwise TipcSrvConnMsgSend first temporarily sets the sender of the message (using the value of the option Unique_Subject), then temporarily prepends the value of the option Default_Subject_Prefix to the message sender and destination if they do not start with slash (/
), and then calls TipcConnMsgSend. See TipcConnMsgSend for more information on sending messages through connections.
For normal usage, check_server_msg_send
should always be TRUE
. This allows the user to globally turn off all normal outgoing messages by setting the option Server_Msg_Send to FALSE
. This is useful for running two RTclients (such as two RTie processes), the primary one with Server_Msg_Send set to TRUE
and the backup one with Server_Msg_Send set to FALSE
.
If RTclient has a warm connection to RTserver, TipcSrvConnMsgSend buffers the message as if the RTclient were still connected to RTserver. See TipcSrvConnOpen for more information on warm connections to RTserver.
None
TipcConnMsgSend, TipcSrvConnMsgWrite
This example creates a NUMERIC_DATA message, appends fields, sets the destination subject, sends the message with TipcSrvConnMsgSend, sets the destination to a second subject, and sends the message again:
T_IPC_MT mt; T_IPC_MSG msg; mt = TipcMtLookupByNum(T_MT_NUMERIC_DATA); if (mt == NULL) {return
; /* error */
} msg = TipcMsgCreate(mt); if (msg == NULL) {return
; /* error */
} if (!TipcMsgAppendStrReal8(msg, "speed_limit", 65.0)) {return
; /* error */
} if (!TipcMsgSetDest(msg, "/system/admin")) {return
; /* error */
}/* send the message */
if (!TipcSrvConnMsgSend(srv, msg, TRUE)) {return
; /* error */
} if (!TipcMsgSetDest(msg, "/system/test")) {return
; /* error */
}/* send the message again, but to a different subject */
if (!TipcSrvConnMsgSend(srv, msg, TRUE)) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |