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: