Waiting for a Message Using recv_exit_msg() or recv_exit_msg_c()

The recv_exit_msg() or recv_exit_msg_c() function waits until it receives a message from IBM® Connect:Direct®. Control is suspended until a message is received or an error occurs. The recv_exit_msg() has the following format:

int recv_exit_msg( int exit_flag )
	int * msg_type, 
	char * recv_buf, 
	int * recv_buf_len

The recv_exit_msg() or recv_exit_msg_c() functions have the following parameters:

Parameter Description Value
exit_flag A flag to specify the recipient ID. The only valid value a user exit program can use is EXIT_PROGRAM. EXIT_PROGRAM
msg_type A pointer to the name of the received message. Messages are requests from IBM Connect:Direct and the associated response from the user exit program. Pointer to message
recv_buf A pointer to the memory location of the message. Pointer to message
recv_buf_len The length in bytes of the message to be received. Length of message

The recv_exit_msg()or recv_exit_msg_c() functions have the following return codes. Return codes for the function are defined in ndmapi.h.

Return Code Description
GOOD_RC

The message was received successfully.

ERROR_RC

An error occurred and the message was not received successfully. Possible causes include: IBM Connect:Direct terminated, an invalid value used for the exit_flag parameter, or the receiving buffer not large enough to hold the message received.