---
name: "nng_aio_begin"
section: "3"
platform: "linux"
package: "libnng-dev"
version: "1.10.1-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/nng_aio_begin"
---

# nng\_aio\_begin(3)

begin asynchronous I/O operation

## NAME

nng\_aio\_begin - begin asynchronous I/O operation

## SYNOPSIS

```
#include <nng/nng.h>
bool nng_aio_begin(nng_aio *aio);
```

## DESCRIPTION

The `nng_aio_begin()` function is called by the I/O provider to indicate that it is going to process the operation.

The function may return `false`, indicating that the *aio* has been closed by the caller asynchronously. In this case the provider should abandon the operation and do nothing else.

This operation should be called at the start of any I/O operation, and must be called not more than once for a given I/O operation on a given *aio*.

Once this function is called, if `true` is returned, then the provider MUST guarantee that `nng_aio_finish()` is called for the *aio* exactly once, when the operation is complete or canceled.

**Note**\

This function is only for I/O providers (those actually performing the operation such as HTTP handler functions or transport providers); ordinary users of the *aio* should not call this function.

## RETURN VALUES

`true`

The operation has been started.

`false`

The operation cannot be started.

## ERRORS

None.

## SEE ALSO

[nng\_aio\_alloc(3)](/nng_aio_alloc/3.md), [nng\_aio\_cancel(3)](/nng_aio_cancel/3.md), [nng\_aio\_defer(3)](/nng_aio_defer/3.md), [nng\_aio\_finish(3)](/nng_aio_finish/3.md), [nng\_aio\_result(3)](/nng_aio_result/3.md), [nng\_aio(5)](/nng_aio/5.md), [nng(7)](/nng/7.md)
