= nng_socket_raw(3)
//
// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
//
// This document is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
// file was obtained (LICENSE.txt).  A copy of the license may also be
// found online at https://opensource.org/licenses/MIT.
//

== NAME

nng_socket_raw - return whether socket is cooked or raw

== SYNOPSIS

[source, c]
----
#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

[horizontal]
`NNG_ECLOSED`:: Parameter _s_ does not refer to an open socket.

== SEE ALSO

[.text-left]
xref:nng_socket.5.adoc[nng_socket(5)],
xref:nng.7.adoc[nng(7)]
