DB_CHANNEL->send_msg()

#include <db.h>

int
DB_CHANNEL->send_msg(DB_CHANNEL *channel, DBT *msg, u_int32_t nmsg,
                     u_int32_t flags);  

The DB_CHANNEL->send_msg() method sends a message on the message channel. The message is sent asynchronously; the method does not wait for a response before returning. This method usually completes quickly because it only waits for the local TCP implementation to accept the bytes into its network data buffer. However, this message could block briefly for longer messages, and/or if the network data buffer is nearly full. This method could even block indefinitely if the remote site is slow to read.

If you want to block while waiting for a response from a remote site, use the DB_CHANNEL->send_request() method instead of this method.

The message sent by this method is received and handled at remote sites using a message dispatch callback, which is configured using the DB_ENV->repmgr_msg_dispatch() method. Note that the DB_CHANNEL->send_msg() method may be used within the message dispatch callback on the remote site to send a response or acknowledgement for messages that it receives and is handling.

This method may be used on channels opened to any destination (see the DB_ENV->repmgr_channel() method for a list of potential destinations).

The DB_CHANNEL->send_msg() method returns a non-zero error value on failure and 0 on success.

Parameters

msg

Refers to an array of DBT handles. For more information, see The DBT Handle .

Any flags provided to the DBT handles used in this array are ignored.

nmsg

Indicates how many elements are contained in the msg array.

flags

This parameter is currently unused, and must be set to 0.

Errors

The DB_CHANNEL->send_msg() method may fail and return one of the following non-zero errors:

DB_NOSERVER

A message was sent to a remote site that has not configured a message dispatch callback function. Use the DB_ENV->repmgr_msg_dispatch() method at every site belonging to the replication group to configure a message dispatch callback function.

EINVAL

If this method is called from a Base API application, or if an invalid flag value or parameter was specified.

Class

DB_ENV, DB_CHANNEL

See Also

Replication and Related Methods