TipcSrvMsgSend publish (send) a message through the connection 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 TipcSrvMsgSend fails, it returns FALSE
and sets the global SmartSockets error number to one of:
msg
was null or the destination of msg
was nullmsg
was not a valid messagecheck_server_msg_send
was not TRUE
or FALSE
, or destination of msg
is not a valid subject
TipcSrvMsgSend 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 TipcSrvMsgSend does not send the message, but returns TRUE
immediately. Otherwise TipcSrvMsgSend 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, TipcSrvMsgSend buffers the message as if the RTclient were still connected to RTserver. See TipcSrvCreate on warm connections to RTserver.
None
TipcConnMsgSend, TipcSrvMsgWrite
This example creates a NUMERIC_DATA message, appends fields, sets the destination subject, sends the message with TipcSrvMsgSend, 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 (!TipcSrvMsgSend(msg, TRUE)) {return
; /* error */
} if (!TipcMsgSetDest(msg, "/system/test")) {return
; /* error */
}/* send the message again, but to a different subject */
if (!TipcSrvMsgSend(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 |