Home Explore Blog CI



neovim

23th chunk of `runtime/doc/luvref.txt`
6942a6a3e62514a0f8740299addde949021ae02d26b9631f0000000100000fa5
 `stream`: `userdata` for sub-type of |uv_stream_t|

                Returns `true` if the stream is writable, `false` otherwise.

                Returns: `boolean`

uv.stream_set_blocking({stream}, {blocking})          *uv.stream_set_blocking()*

                > method form `stream:set_blocking(blocking)`

                Parameters:
                - `stream`: `userdata` for sub-type of |uv_stream_t|
                - `blocking`: `boolean`

                Enable or disable blocking mode for a stream.

                When blocking mode is enabled all writes complete
                synchronously. The interface remains unchanged otherwise, e.g.
                completion or failure of the operation will still be reported
                through a callback which is made asynchronously.

                Returns: `0` or `fail`

                WARNING: Relying too much on this API is not recommended. It
                is likely to change significantly in the future. Currently
                this only works on Windows and only for |uv_pipe_t| handles.
                Also libuv currently makes no ordering guarantee when the
                blocking mode is changed after write requests have already
                been submitted. Therefore it is recommended to set the
                blocking mode immediately after opening or creating the
                stream.

uv.stream_get_write_queue_size()              *uv.stream_get_write_queue_size()*

                > method form `stream:get_write_queue_size()`

                Returns the stream's write queue size.

                Returns: `integer`

==============================================================================
`uv_tcp_t` — TCP handle                                  *luv-tcp-handle* *uv_tcp_t*

> |uv_handle_t| and |uv_stream_t| functions also apply.

TCP handles are used to represent both TCP streams and servers.

uv.new_tcp([{flags}])                                             *uv.new_tcp()*

                Parameters:
                - `flags`: `string` or `integer` or `nil`

                Creates and initializes a new |uv_tcp_t|. Returns the Lua
                userdata wrapping it.

                If set, `flags` must be a valid address family. See
                |luv-constants| for supported address family input values.

                Returns: `uv_tcp_t userdata` or `fail`

uv.tcp_open({tcp}, {sock})                                       *uv.tcp_open()*

                > method form `tcp:open(sock)`

                Parameters:
                - `tcp`: `uv_tcp_t userdata`
                - `sock`: `integer`

                Open an existing file descriptor or SOCKET as a TCP handle.

                Returns: `0` or `fail`

                Note: The passed file descriptor or SOCKET is not checked for
                its type, but it's required that it represents a valid stream
                socket.

uv.tcp_nodelay({tcp}, {enable})                               *uv.tcp_nodelay()*

                > method form `tcp:nodelay(enable)`

                Parameters:
                - `tcp`: `uv_tcp_t userdata`
                - `enable`: `boolean`

                Enable / disable Nagle's algorithm.

                Returns: `0` or `fail`

uv.tcp_keepalive({tcp}, {enable} [, {delay}])               *uv.tcp_keepalive()*

                > method form `tcp:keepalive(enable, [delay])`

                Parameters:
                - `tcp`: `uv_tcp_t userdata`
                - `enable`: `boolean`
                - `delay`: `integer` or `nil`

                Enable / disable TCP keep-alive. `delay` is the initial delay
                in seconds, ignored when enable is `false`.

                Returns: `0` or `fail`

uv.tcp_simultaneous_accepts({tcp}, {enable})     *uv.tcp_simultaneous_accepts()*

                > method form `tcp:simultaneous_accepts(enable)`

                Parameters:
                - `tcp`: `uv_tcp_t userdata`
                - `enable`:

Title: Libuv Stream and TCP Handle Functions
Summary
This section describes libuv functions for managing streams and TCP handles. It details `uv.stream_get_write_queue_size()`, which returns the stream's write queue size. It then moves on to TCP handles (`uv_tcp_t`), which represent TCP streams and servers, and explains the related functions: `uv.new_tcp()` for creating a new TCP handle, `uv.tcp_open()` for opening an existing file descriptor or SOCKET as a TCP handle, `uv.tcp_nodelay()` for enabling or disabling Nagle's algorithm, `uv.tcp_keepalive()` for enabling or disabling TCP keep-alive, and `uv.tcp_simultaneous_accepts()` for enabling or disabling simultaneous accepts.