Home Explore Blog CI



neovim

25th chunk of `runtime/doc/luvref.txt`
052541f6cb2c318711cf8cf5e73b8c3a55f5aa6157b689170000000100000fa1
 connected to the handle.

                See |luv-constants| for supported address `family` output values.

                Returns: `table` or `fail`
                - `ip` : `string`
                - `family` : `string`
                - `port` : `integer`

uv.tcp_getsockname({tcp})                                 *uv.tcp_getsockname()*

                > method form `tcp:getsockname()`

                Parameters:
                - `tcp`: `uv_tcp_t userdata`

                Get the current address to which the handle is bound.

                See |luv-constants| for supported address `family` output values.

                Returns: `table` or `fail`
                - `ip` : `string`
                - `family` : `string`
                - `port` : `integer`

uv.tcp_connect({tcp}, {host}, {port}, {callback})             *uv.tcp_connect()*

                > method form `tcp:connect(host, port, callback)`

                Parameters:
                - `tcp`: `uv_tcp_t userdata`
                - `host`: `string`
                - `port`: `integer`
                - `callback`: `callable`
                   - `err`: `nil` or `string`

                Establish an IPv4 or IPv6 TCP connection.

                Returns: `uv_connect_t userdata` or `fail`

                    >lua
                    local client = uv.new_tcp()
                    client:connect("127.0.0.1", 8080, function (err)
                      -- check error and carry on.
                    end)
<

uv.tcp_write_queue_size({tcp})                       *uv.tcp_write_queue_size()*

                > method form `tcp:write_queue_size()`

                DEPRECATED: Please use |uv.stream_get_write_queue_size()|
                instead.

uv.tcp_close_reset([{callback}])                          *uv.tcp_close_reset()*

                > method form `tcp:close_reset([callback])`

                Parameters:
                - `tcp`: `uv_tcp_t userdata`
                - `callback`: `callable` or `nil`

                Resets a TCP connection by sending a RST packet. This is
                accomplished by setting the SO_LINGER socket option with a
                linger interval of zero and then calling |uv.close()|. Due to
                some platform inconsistencies, mixing of |uv.shutdown()| and
                `uv.tcp_close_reset()` calls is not allowed.

                Returns: `0` or `fail`
                                                               *uv.socketpair()*
uv.socketpair([{socktype}, [{protocol}, [{flags1}, [{flags2}]]]])

                Parameters:
                - `socktype`: `string`, `integer` or `nil` (default: `stream`)
                - `protocol`: `string`, `integer` or `nil` (default: 0)
                - `flags1`: `table` or `nil`
                  - `nonblock`: `boolean` (default: `false`)
                - `flags2`: `table` or `nil`
                  - `nonblock`: `boolean` (default: `false`)

                Create a pair of connected sockets with the specified
                properties. The resulting handles can be passed to
                |uv.tcp_open()|, used with |uv.spawn()|, or for any other
                purpose.

                See |luv-constants| for supported `socktype` input values.

                When `protocol` is set to 0 or nil, it will be automatically
                chosen based on the socket's domain and type. When `protocol`
                is specified as a string, it will be looked up using the
                `getprotobyname(3)` function (examples: `"ip"`, `"icmp"`,
                `"tcp"`, `"udp"`, etc).

                Flags:
                 - `nonblock`: Opens the specified socket handle for
                   `OVERLAPPED` or `FIONBIO`/`O_NONBLOCK` I/O usage. This is
                   recommended for handles that will be used by libuv, and not
                   usually recommended otherwise.

                Equivalent to `socketpair(2)` with a domain of `AF_UNIX`.

                Returns:

Title: Libuv TCP Functions: Address Information, Connection, and Socket Pair Creation
Summary
This section continues detailing libuv TCP functions, including `uv.tcp_getpeername()` and `uv.tcp_getsockname()` to retrieve address information. It covers `uv.tcp_connect()` for establishing TCP connections, `uv.tcp_write_queue_size()` (deprecated in favor of `uv.stream_get_write_queue_size()`) and `uv.tcp_close_reset()` for resetting TCP connections. Finally, it describes `uv.socketpair()` for creating a pair of connected sockets with specified properties, similar to `socketpair(2)`.