Library Version 18.1.40

DB_ENV->repmgr_channel()
Prev | Chapter 10. Replication Methods | Next

## DB_ENV->repmgr_channel()

    #include <db.h>

    int
    DB_ENV->repmgr_channel(DB_ENV *env, int eid, DB_CHANNEL **channelp,
        u_int32_t flags);

The `DB_ENV->repmgr_channel()` method returns a DB_CHANNEL handle. This is used to create and manage custom message traffic between the sites in the replication group.

This method allocates memory for the handle, returning a pointer to the structure in the memory to which channelp refers. To release the allocated memory and discard the handle, call the DB_CHANNEL->close() method.

The `DB_ENV->repmgr_channel()` method may be called at any time after DB_ENV->repmgr_start() has been called with a `0` return code.

The `DB_ENV->repmgr_channel()` method returns a non-zero error value on failure and 0 on success.

### Parameters

#### eid

This parameter must be set to one of the following:

- The numerical environment ID of a remote site in the replication group.

- `DB_EID_MASTER`

  Messages sent on this channel are sent only to the master site. Note that messages are always sent to the current master, even if the master has changed since the channel was opened. If the current master is disconnected or unknown, the operation fails and Replication Manager returns an error code.

  If the local site is the master, then sending messages on this channel will result in the local site receiving those messages echoed back to itself.

#### channelp

References memory into which a pointer to the allocated handle is copied.

#### flags

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

### Errors

The `DB_ENV->repmgr_channel()` method may fail and return one of the following non-zero errors:

#### DB_REP_UNAVAIL

If the eid parameter is `DB_EID_MASTER` but the current master is disconnected or unknown.

#### EINVAL

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

### Class

DB_ENV

### See Also

Replication and Related Methods, The DB_CHANNEL Handle

Prev | Up | Next
DB_ENV->rep_sync() | Home | DB_ENV->repmgr_local_site()