Library Version 11.2.5.3

DbChannel::send_msg()
Prev | Chapter 11. Replication Methods | Next

## DbChannel::send_msg()

    #include <db_cxx.h>

    int
    DbChannel::send_msg(Dbt *msg, u_int32_t nmsg, u_int32_t flags);

The `DbChannel::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 DbChannel::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 DbEnv::repmgr_msg_dispatch() method. Note that the DbChannel::send_msg() method may be used within the 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 DbEnv::repmgr_channel() method for a list of potential destinations).

The `DbChannel::send_msg()` method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 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 `DbChannel::send_msg()` method may fail and throw a DbException exception, encapsulating one of the following non-zero errors, or 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 call-back function. Use the DbEnv::repmgr_msg_dispatch() method at every site belonging to the replication group to configure a message dispatch call-back function.

#### EINVAL

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

### Class

DbEnv

### See Also

Replication and Related Methods

Prev | Up | Next
DbChannel::close() | Home | DbChannel::send_request()