int mb_register( int socket, int msg_id, char *app_name, int sync )
mb_register enables the calling process to receive messages sent to app_name. socket is a connector returned by a previous call to
mb_bind. msg_id is a request number which can be used to uniquely identify the reply.
app_name specifies the public name under which the calling process wishes to be known. If it is (char *)0, the calling process will not be registered to receive messages from other processes.
If sync is 1, the calling process is blocked until the bus responds and
mb_register returns the number of processes registered as app_name or -1 if an error occurred. Use sync only if you are sure no other messages are waiting to be read.
If sync is 0,
mb_register immediately returns 0 or -1 in an error occurred. The reply must be read with
If another process is already registered as app_name, it will continue to receive messages sent to app_name. When it exits, the bus will start forwarding messages sent to app_name to one of the other processes bound as app_name.