nng_stream_close(3str)

# nng_stream_close(3str) Manual Page

## NAME

nng_stream_close - close byte stream

## SYNOPSIS

    #include <nng/nng.h>

    void nng_stream_close(nng_stream *s);

## DESCRIPTION

The `nng_stream_close()` function closes the byte stream s.

If any operations are pending, such as `nng_stream_send()` or `nng_stream_recv()`, they will be terminated with an `NNG_ECLOSED` error condition. Also, any new operations will fail with `NNG_ECLOSED` after the connection is closed.

| Closing the connection while data is in transmission will likely lead to loss of that data. There is no automatic linger or flush to ensure that the socket send buffers have completely transmitted.

| Closing the connection does not free the resources associated with it. Once it is certain that no more operations are pending on the connection, it should be freed with `nng_stream_free()`.

## RETURN VALUES

None.

## ERRORS

None.

## SEE ALSO

nng_strerror(3), nng_stream_free(3str), nng_stream_recv(3str), nng_stream_send(3str), nng_stream(5)