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

# nng\_pipe\_close(3)

close pipe

## NAME

nng\_pipe\_close - close pipe

## SYNOPSIS

```
#include <nng/nng.h>
int nng_pipe_close(nng_pipe p);
```

## DESCRIPTION

The `nng_pipe_close()` function closes the supplied pipe, *p*. Messages that have been submitted for sending may be flushed or delivered, depending upon the transport.

Further attempts to use the pipe after this call returns will result in `NNG_ECLOSED`.

**Tip**\

Pipes are automatically closed when their creator closes, or when the remote peer closes the underlying connection.

## RETURN VALUES

This function returns 0 on success, and non-zero otherwise.

## ERRORS

`NNG_ECLOSED`

The pipe *p* is already closed or was never opened.

## SEE ALSO

[nng\_strerror(3)](/nng_strerror/3.md), [nng\_options(5)](/nng_options/5.md), [nng\_pipe(5)](/nng_pipe/5.md), [nng(7)](/nng/7.md)
