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 Sterling 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

EXIT_PROGRAM

 

value a user exit program can use is

 

 

EXIT_PROGRAM.

 

 

 

 

msg_type

A pointer to the name of the received message.

Pointer to message

 

Messages are requests from Sterling Connect:Direct

 

 

and the associated response from the user exit

 

 

program.

 

 

 

 

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

GOOD_RC

ERROR_RC

Description

The message was received successfully.

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

Passing a File Descriptor Using send_exit_file() or send_exit_file_c()

Use the send_exit_file() or send_exit_file_c() function to pass a file descriptor from one Process to another Process. Following is the format of send_exit_file():

int send_exit_file int exit_flag int fd

Following are the parameters for send_exit_file() or send_exit_file_c():

Parameter

Description

Value

 

 

 

exit_flag

A flag to specify the sender ID. The only valid value a

EXIT_PROGRAM

 

user exit program can use is EXIT_PROGRAM.

 

 

 

 

fd

The file descriptor of a file that the user exit program

File descriptor

 

opened in the place of Sterling Connect:Direct, similar to

 

 

one returned by the open(2) function.

 

 

 

 

Chapter 5. Writing User Exits 77

Page 83
Image 83
IBM 4J manual Waiting for a Message Using recvexitmsg or recvexitmsgc, Exitprogram