Library Version 12.1.6.2

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

## DB_ENV->repmgr_site()

    #include <db.h>

    int
    DB_ENV->repmgr_site(DB_ENV *env, const char *host,
        u_int port, DB_SITE **sitep, u_int32_t flags);

The `DB_ENV->repmgr_site()` method returns a DB_SITE handle that defines a site's network address. You use the DB_SITE handle to configure and manage a Replication Manager site.

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

You must use the exact same host identification string and port number to refer to a given site throughout your application and on each of its sites.

The `DB_ENV->repmgr_site()` method may be called at any time after the environment handle has been created.

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

### Parameters

#### host

The site's host identification string, generally a TCP/IP host name. IPv6 and IPv4 addresses in numeric format are also accepted. If multiple addresses are defined for a host name, an IPv6 address is used whenever possible.

#### port

The port number on which the site is listening.

#### sitep

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_site()` method may fail and return one of the following non-zero errors:

#### 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_SITE Handle

Prev | Up | Next
DB_ENV->repmgr_set_socket() | Home | DB_ENV->repmgr_site_by_eid()