more desired api
This commit is contained in:
parent
55de5e3242
commit
5be0fe2168
@ -24,8 +24,10 @@ common:
|
||||
A TCP server class that is a subclass of `uv_handle_t`. This can be bound to
|
||||
an address and begin accepting new TCP sockets.
|
||||
|
||||
## `int uv_bind4(uv_tcp_server_t* tcp_server, struct sockaddr_in* address);`
|
||||
## `int uv_bind6(uv_tcp_server_t* tcp_server, struct sockaddr_in6* address);`
|
||||
|
||||
`int uv_bind4(uv_tcp_server_t* tcp_server, struct sockaddr_in* address);`
|
||||
|
||||
`int uv_bind6(uv_tcp_server_t* tcp_server, struct sockaddr_in6* address);`
|
||||
|
||||
Binds the TCP server to an address. The `address` can be created with
|
||||
`uv_ip4_addr()`. Call this before `uv_listen()`
|
||||
@ -48,7 +50,8 @@ An abstract subclass of `uv_handle_t`. Streams represent something that
|
||||
reads and/or writes data. Streams can be half or full-duplex. TCP sockets
|
||||
are streams, files are streams with offsets.
|
||||
|
||||
## `int uv_read_start(uv_stream_t* stream, uv_alloc_cb alloc_cb, uv_read_cb read_cb);`
|
||||
|
||||
`int uv_read_start(uv_stream_t* stream, uv_alloc_cb alloc_cb, uv_read_cb read_cb);`
|
||||
|
||||
Starts the stream reading continuously. The `alloc_cb` is used to allow the
|
||||
user to implement various means of supplying the stream with buffers to
|
||||
@ -56,12 +59,23 @@ fill. The `read_cb` returns buffers to the user filled with data.
|
||||
|
||||
Sometimes the buffers returned to the user do not contain data. This does
|
||||
not indicate EOF as in other systems. EOF is made via the `uv_eof_cb` which
|
||||
can be set like this
|
||||
|
||||
uv_set_eof_cb(stream, eof_cb);
|
||||
can be set like this `uv_set_eof_cb(stream, eof_cb);`
|
||||
|
||||
|
||||
## `int uv_read_stop(uv_stream_t* stream);`
|
||||
`int uv_read_stop(uv_stream_t* stream);`
|
||||
|
||||
Stops reading from the stream.
|
||||
|
||||
|
||||
`int uv_write_req_init(uv_write_req_t*, uv_stream_t*, uv_buf_t bufs[], int butcnf);`
|
||||
|
||||
Initiates a write request on a stream.
|
||||
|
||||
|
||||
`int uv_shutdown_req_init(uv_shutdown_req_t*, uv_stream_t*)`
|
||||
|
||||
Initiates a shutdown of outgoing data once the write queue drains.
|
||||
|
||||
|
||||
|
||||
# `uv_tcp_t`
|
||||
@ -84,7 +98,7 @@ Subclass of `uv_req_t`. Represents a request for a TCP connection. Operates
|
||||
on `uv_tcp_t` handles. Like other types of requests the `close_cb` indicates
|
||||
completion of the request.
|
||||
|
||||
## `int uv_connect_req_init(uv_connect_req_t* req, uv_tcp_t* socket, struct sockaddr* addr, uv_close_cb close_cb, void* data);`
|
||||
`int uv_connect_req_init(uv_connect_req_t* req, uv_tcp_t* socket, struct sockaddr* addr, uv_close_cb close_cb, void* data);`
|
||||
|
||||
Initializes the connection request. Returning 0 indicates success, -1 if
|
||||
there was an error. The following values can be retrieved from
|
||||
|
||||
Loading…
Reference in New Issue
Block a user