> For the complete documentation index, see [llms.txt](https://docs.ndi.video/all/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ndi.video/all/developing-with-ndi/sdk/ndi-sender-discovery-and-monitor/ndi-sender-advertiser.md). Agents can also search and read this documentation through its [MCP server](https://docs.ndi.video/all/~gitbook/mcp).

# NDI Sender Advertiser

The `NDIlib_send_advertiser_create` function creates an instance of the sender advertiser. This function returns an instance of type NDIlib\_send\_advertiser\_create\_t (or NULL if it fails), representing the sender advertiser instance.

The function takes parameters defined by NDIlib\_send\_advertiser\_create\_t, as follows:

<table><thead><tr><th valign="top">Parameter</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top">p_url_address (const char*)</td><td valign="top"><p>This parameter represents the URL address of the NDI Discovery Server to connect to. If NULL, the default NDI discovery server will be used. If no discovery server is available, the sender advertiser will not be instantiated, and the create function will return NULL. The format of this field is expected to be the hostname or IP address, optionally followed by a colon and a port number. If the port number is not specified, port 5959 will be used.</p><p>For example: 127.0.0.1:5959, 127.0.0.1, or hostname:5959. This field can also specify multiple addresses separated by commas for redundancy support.</p></td></tr></tbody></table>

Once the structure is filled out, `NDIlib_send_advertiser_create` will create an instance for you. The sender advertiser instance is destroyed by passing it into `NDIlib_send_advertiser_destroy`.

## Adding a Sender for Advertising

To add your NDI sender for advertising, call the following function:

```
bool NDIlib_send_advertiser_add_sender(
     NDIlib_send_advertiser_instance_t p_instance,
     NDIlib_send_instance_t p_sender,
     bool allow_monitoring
);
```

This function adds the sender to the list of senders being advertised. It returns false if the sender has been previously registered.

**Parameters**:

* `p_instance`: The sender advertiser instance from the `NDIlib_send_advertiser_create` call.
* `p_sender`: An already instantiated NDI sender instance from the `NDIlib_send_create` call.
* `allow_monitoring`: A flag to allow monitoring of the sender.

## Removing a Sender from Advertising

To remove the sender from the list of senders being advertised, call the corresponding function:

```
bool NDIlib_send_advertiser_del_sender(
     NDIlib_send_advertiser_instance_t p_instance,
     NDIlib_send_instance_t p_sender
);
```

This function returns false if the sender was not previously advertised.

**Example Code:**

The following code illustrates how to add/register a sender and remove it from the advertiser. Note: A full example is provided with the SDK that illustrates registering a sender for advertisement (we will not reproduce that code here).

```
// Create an unconnected sender that will be set up for advertising.
NDIlib_send_instance_t pNDI_sender = NDIlib_send_create();
if (!pNDI_sender) {
    // Handle error
}
 
// Create an instance of the sender advertiser
NDIlib_send_advertiser_instance_t pNDI_send_advertiser = NDIlib_send_advertiser_create();
if (!pNDI_send_advertiser) {
    // Handle error
}
 
// Register the sender with the advertiser
NDIlib_send_advertiser_add_sender(pNDI_send_advertiser, pNDI_sender, true);
 
// Do stuff
...
 
// Remove the sender from the advertiser before destroying it
NDIlib_send_advertiser_del_sender(pNDI_send_advertiser, pNDI_sender);
 
// Destroy the sender advertiser
NDIlib_send_advertiser_destroy(pNDI_send_advertiser);
 
// Destroy the sender
NDIlib_send_destroy(pNDI_sender);
```

This example demonstrates the creation, registration, and destruction of an NDI sender and its associated advertiser.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ndi.video/all/developing-with-ndi/sdk/ndi-sender-discovery-and-monitor/ndi-sender-advertiser.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
