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

# nng\_socket\_raw(3)

return whether socket is cooked or raw

## NAME

nng\_socket\_raw - return whether socket is cooked or raw

## SYNOPSIS

```
#include <nng/nng.h>
int nng_socket_raw(nng_socket s, bool *raw);
```

## DESCRIPTION

The `nng_socket_raw()` function stores `true` in *raw* if the socket is in raw mode, otherwise it stores `false`.

**Tip**\

This function should be used in place of the `NNG_OPT_RAW` option in new code.

## RETURN VALUES

This function returns zero on success, or an error if the socket is invalid.

## ERRORS

`NNG_ECLOSED`

Parameter *s* does not refer to an open socket.

## SEE ALSO

[nng\_socket(5)](/nng_socket/5.md), [nng(7)](/nng/7.md)
