aboutsummaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
authorSaúl Ibarra Corretgé <saghul@gmail.com>2015-06-17 00:34:58 +0200
committerSaúl Ibarra Corretgé <saghul@gmail.com>2015-06-19 09:37:19 +0200
commitf8f59824c4731122ac1e0520b42fbd3b306c48c1 (patch)
tree740b45461ce10679ae03025c0e76e5ddafacd201 /docs/src
parent2dddd565fd0dff30460eec1542693af0ac6bfafa (diff)
downloadlibuv-f8f59824c4731122ac1e0520b42fbd3b306c48c1.tar.gz
libuv-f8f59824c4731122ac1e0520b42fbd3b306c48c1.zip
unix, win: add ability to create tcp/udp sockets early
Introduce two new APIs: int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, int flags) int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, int flags) The lower 8 bits of the flags field are used for the socket domain. AF_INET, AF_INET6 and AF_UNSPEC are supported. If AF_UNSPEC is specified the socket is created lazily, just like uv_{tcp,udp}_init. Some Windows notes: getsockname fails with WSAEINVAL if the socket is not bound. This could potentially be improved by detecting the socket family and filling the sockaddr_in/6 struct manually. bind returns WSAEFAULT if we try to bind a socket to the wrong family. Unix returns EINVAL. PR-URL: https://github.com/libuv/libuv/pull/400 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/tcp.rst11
-rw-r--r--docs/src/udp.rst9
2 files changed, 19 insertions, 1 deletions
diff --git a/docs/src/tcp.rst b/docs/src/tcp.rst
index dd746fe8..56a27e4e 100644
--- a/docs/src/tcp.rst
+++ b/docs/src/tcp.rst
@@ -30,7 +30,16 @@ API
.. c:function:: int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle)
- Initialize the handle.
+ Initialize the handle. No socket is created as of yet.
+
+.. c:function:: int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, unsigned int flags)
+
+ Initialize the handle with the specified flags. At the moment the lower 8 bits
+ of the `flags` parameter are used as the socket domain. A socket will be created
+ for the given domain. If the specified domain is ``AF_UNSPEC`` no socket is created,
+ just like :c:func:`uv_tcp_init`.
+
+ .. versionadded:: 1.7.0
.. c:function:: int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock)
diff --git a/docs/src/udp.rst b/docs/src/udp.rst
index ec7ce56d..3b77b9d9 100644
--- a/docs/src/udp.rst
+++ b/docs/src/udp.rst
@@ -110,6 +110,15 @@ API
Initialize a new UDP handle. The actual socket is created lazily.
Returns 0 on success.
+.. c:function:: int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, unsigned int flags)
+
+ Initialize the handle with the specified flags. At the moment the lower 8 bits
+ of the `flags` parameter are used as the socket domain. A socket will be created
+ for the given domain. If the specified domain is ``AF_UNSPEC`` no socket is created,
+ just like :c:func:`uv_udp_init`.
+
+ .. versionadded:: 1.7.0
+
.. c:function:: int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock)
Opens an existing file descriptor or Windows SOCKET as a UDP handle.