book
Article ID: KB0092302
calendar_today
Updated On:
Description
Resolution:
T_IPC_MSG TipcConnMsgSearch(conn, timeout, func, arg)
1). the client will traverse it's existing message_queue applying func to each message.
2). If the search does not find a message that satisfies func (i.e. func never returns a non-NULL value) then when it finishes traversing the entire queue TipcConnMsgSearch calls the following:
Begin_Loop:
TipcConnRead(conn, 0.0)
This pulls any messages from the socket_buffer into the read_buffer and from there into the message_queue.
3). The client again searches the message_queue starting the search at the beginning of the queue in order to accommodate message_priority which only comes into play when messages are placed on the message_queue. If no message is found that satisfies func
4). There is then a call to check_timeout(timeout);
if (timeout == 0.0)
return;
else
; // goto Begin_Loop:
So when you call:
TipcConnMsgSearch(srv, 0.0, func, arg)
You get the following
search_queue
if(msg==NULL)
read
search_queue
return;
Additionally, if there is more than one message in the message_queue that satisfies the condition of func then TipcConnMsgSearch returns after reading the first message, that being, it does not continue searching the message_queue to the end. To get the next message that satisfies func from the message_queue you have to call TipcConnMsgSearch again.
Issue/Introduction
How does the function TipcConnMsgSearch work with a timeout of Zero?