Receiving messages with GMD is even easier than sending messages with GMD; no code changes are needed. TipcConnRead automatically calls TipcConnGmdFileCreate if necessary. For GMD, TipcConnRead recognizes a message resent with GMD (through an internal message resend property) and checks if the resent message has a sequence number lower than the highest sequence number already acknowledged from the sending process. The check also handles long-running processes that may overflow and wrap around the four-byte sequence number. If the resent message has already been acknowledged, then TipcConnRead immediately destroys the message, which acknowledges it again so that the sender is notified this time of successful delivery.
TipcConnRead ignores any duplicate (resent) messages that are sent to it while the application is processing the message and has not yet sent an acknowledgement. This means that TipcConnRead keeps all received but unacknowledged GMD messages, and discards any subsequent GMD messages with the same sequence number and from the same publisher as long as the original GMD message remains unacknowledged. All other non-resent GMD messages are allowed to pass through regardless of their sequence number. This allows flexibility and correct behavior when some processes use TipcConnGmdFileDelete and others do not (thus continuing to use old sequence numbers).
TipcConnRead also handles GMD_ACK messages directly so that the application code never has to worry about taking care to read and process one GMD_ACK message for each outgoing message sent with GMD. When a GMD_ACK message is received, the corresponding message is removed from the connection GMD area. The following output from the example client program shows how GMD_ACK messages are visible to the connection read callbacks but not to the connection process or default callbacks:
Read data to allow acknowledgments time to come in. read: type gmd_ack, seq_num 0 GMD_ACK field: 1 read: type gmd_ack, seq_num 0 GMD_ACK field: 2
TIBCO SmartSockets™ User’s Guide Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |