dmh::mbx_timed_get replybox ?timeout?
dmh::mbx_xact_pat boxname msg ?replybox timeout pattern?
These commands build upon the low-level mbx commands and features of Tcl to provide higher-level functions for applications.
The commands that monitor for timing out, namely, mbx_do_xact, mbx_timed_get, and mbx_xact_pat, can all be safely used in multiple instances provided each usage has specified a unique replybox argument value. While waiting, your Tcl/Tk application continues to respond to events such as GUI actions, or mbx messages being received.
The command mbx_timed_get is used to wait for a message to arrive in a particular mailbox. The data of the message is returned or the literal text TIMEOUT is returned if the message is not received within the specified interval. The argument timeout is used to specify the timeout interval in milliseconds. The default value of this argument is 10000 (ten seconds). A typical use might be to send a message to a server using mbx putr and then use this command to obtain the reply.
The command mbx_do_xact is used to send a message to a server and receive a list of replies within a timeout period. The command is used when the developer knows how many replies to expect. The command returns when replyct messages have been received, or the timeout interval has expired. If the latter does occur, the last message of the returned list will be the literal string TIMEOUT. Default values for the optional arguments are: replybox, reply mailbox of TKREPLY; replyct, reply message count of 1; timeout, timeout interval of 10000 milliseconds. There is no problem having several instances of mbx_do_xact simultaneously active as might occur from having multiple mbx whenmsg callbacks setup; however, be careful that each usage has its own replybox argument value. An improved version of the mbx_do_xact procedure is distributed with the Hume SECS/GEM applications. The improved procedure, ::humelib::mbx_xact creates unique values for the replybox argument when it is defaulted.
The command mbx_xact_pat is used to send a message to a server and receive a list of replies within a timeout period. The command returns when the last message received contains the argument pattern or when the timeout period has elapsed. The pattern argument defaults to //c which is used by SEMATECH servers to distinguish the final reply message. The arguments replybox and timeout default to TKREPLY and 10000 milliseconds respectively.