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

# nng\_sub\_open(3)

create sub socket

## NAME

nng\_sub\_open - create sub socket

## SYNOPSIS

```
#include <nng/nng.h>
#include <nng/protocol/pubsub0/sub.h>
int nng_sub0_open(nng_socket *s);
int nng_sub0_open_raw(nng_socket *s);
```

## DESCRIPTION

The `nng_sub0_open()` function creates a *sub* version 0 socket and returns it at the location pointed to by *s*.

The `nng_sub0_open_raw()` function creates a *sub* version 0 socket in raw mode and returns it at the location pointed to by *s*.

## RETURN VALUES

These functions return 0 on success, and non-zero otherwise.

## ERRORS

`NNG_ENOMEM`

Insufficient memory is available.

`NNG_ENOTSUP`

The protocol is not supported.

## SEE ALSO

[nng\_socket(5)](/nng_socket/5.md), [nng\_pub(7)](/nng_pub/7.md), [nng\_sub(7)](/nng_sub/7.md), [nng(7)](/nng/7.md)
