lrt_tpsetunsol

Communication Functions

Sets the procedure for handling unsolicited messages. Windows platforms only.

void *lrt_tpsetunsol( void *func );

func Pointer to a procedure

The lrt_tpsetunsol function sets the callback procedure that is invoked when an unsolicited message is received. The callback procedure must be defined in an external DLL and have the following prototype:

void (*)(*disp) (char *data, long len, long flags)))

where data is the unsolicited message and len is the message length. The flags parameter is unused.

Return Values

If the function is successful, it returns the previous setting for unsolicited message handling routine (NULL if not set previously). If it fails, it returns TPUNSOLERR and sets tperrno to indicate the error condition.

Parameterization

You cannot use standard parameterization for any arguments in this function.

Example

The following code at the beginning of the client program sets unsolicited_msg_callback as the callback procedure which handles unsolicited messages.

Copy code
extern void unsolicited_msg_callback(char *data, long len, long flags);
tpresult_int = lrt_tpinitialize(LRT_END_OF_PARMS);
lrt_abort_on_error();
lrt_tpsetunsol(unsolicited_msg_callback);