> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_open.md).

# mariadb\_rpl\_open()

Opens a binary log stream. Registers the client as a replica with the connected server and begins streaming binary log events.

### Syntax

```sql
#include <mariadb_rpl.h>

int mariadb_rpl_open(MARIADB_RPL *rpl);
```

### Parameters

| Parameter | Description                                                                                                                                                                                                                                                                           |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `rpl`     | A replication handle, previously allocated by [`mariadb_rpl_init()`](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_init.md). At a minimum, `MARIADB_RPL_SERVER_ID` must have been set before this call. |

### Return Value

Returns zero on success, non-zero on failure. Call `mariadb_rpl_error()` to retrieve the error message.

### History

Added in [MariaDB Connector/C 3.1.0](/docs/release-notes/connectors/c/3.1/3.1.0.md).

### See Also

* [`mariadb_rpl_init()`](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_init.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_open.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
