You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-17Lines changed: 24 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -151,7 +151,8 @@ Core to Async-IO is the event-loop. We provide an implementation for most platfo
151
151
Platform | Implementation
152
152
--- | ---
153
153
Linux | Edge-Triggered Epoll
154
-
BSD Variants and Apple Devices | KQueue
154
+
BSD Variants | KQueue
155
+
Apple Devices | KQueue or Apple Dispatch Queue
155
156
Windows | IOCP (IO Completion Ports)
156
157
157
158
Also, you can always implement your own as well.
@@ -645,7 +646,7 @@ All exported functions, simply shim into the v-table and return.
645
646
646
647
We include a cross-platform API for sockets. We support TCP and UDP using IPv4 and IPv6, and Unix Domain sockets. On Windows,
647
648
we use Named Pipes to support the functionality of Unix Domain sockets. On Windows, this is implemented with winsock2, and on
648
-
all unix platforms we use the posix API.
649
+
all unix platforms we use the posix API. We also provides options to use Apple Network Framework on Apple.
649
650
650
651
Upon a connection being established, the new socket (either as the result of a `connect()` or `start_accept()` call)
651
652
will not be attached to any event loops. It is your responsibility to register it with an event loop to begin receiving
@@ -715,47 +716,53 @@ upon completion of asynchronous operations. If you are using UDP or LOCAL, `conn
715
716
716
717
Shuts down any pending operations on the socket, and cleans up state. The socket object can be re initialized after this operation.
717
718
718
-
int aws_socket_connect(struct aws_socket *socket, struct aws_socket_endpoint *remote_endpoint);
719
+
int aws_socket_set_cleanup_complete_callback(struct aws_socket *socket, aws_socket_on_shutdown_complete_fn fn, void *user_data);
719
720
720
-
Connects to a remote endpoint. In UDP, this simply binds the socket to a remote address for use with `aws_socket_write()`,
721
-
and if the operation is successful, the socket can immediately be used for write operations.
721
+
Sets the clean up completion callback. The callback will be invoked if `aws_socket_clean_up()` finish to clean up the socket resources. It is safe to release the socket memory after this callback is invoked.
722
722
723
-
In TCP, this will function will not block. If the return value is successful, then you must wait on the `on_connection_established()`
Connects to a remote endpoint. In TCP and all Apple Network Framework connections (regardless it is UDP, TCP or LOCAL), when the connection succeed, you still must wait on the `on_connection_result()` callback to be invoked before using the socket.
726
+
727
+
In UDP, this simply binds the socket to a remote address for use with `aws_socket_write()`, and if the operation is successful,
728
+
the socket can immediately be used for write operations.
725
729
726
730
For LOCAL (Unix Domain Sockets or Named Pipes), the socket will be immediately ready for use upon a successful return.
727
731
728
732
int aws_socket_bind(struct aws_socket *socket, struct aws_socket_endpoint *local_endpoint);
729
733
730
-
Binds the socket to a local address. In UDP mode, the socket is ready for `aws_socket_read()` operations. In connection oriented
731
-
modes, you still must call `aws_socket_listen()` and `aws_socket_start_accept()` before using the socket.
734
+
Binds the socket to a local address. In UDP mode, the socket is ready for `aws_socket_read()` operations. In connection oriented
735
+
modes or if you are using Apple Network Framework (regardless it is UDP or TCP), you still must call `aws_socket_listen()` and
736
+
`aws_socket_start_accept()` before using the socket.
732
737
733
738
int aws_socket_listen(struct aws_socket *socket, int backlog_size);
734
739
735
-
TCPand LOCAL only. Sets up the socket to listen on the address bound to in `aws_socket_bind()`.
740
+
TCP, LOCAL, and Apple Network Framework only. Sets up the socket to listen on the address bound to in `aws_socket_bind()`.
736
741
737
-
int aws_socket_start_accept(struct aws_socket *socket);
742
+
int aws_socket_start_accept(struct aws_socket *socket, struct aws_event_loop *accept_loop, struct aws_socket_listener_options options);
738
743
739
-
TCP and LOCAL only. The socket will begin accepting new connections. This is an asynchronous operation. New connections will
740
-
arrive via the `on_incoming_connection()` callback.
744
+
TCP, LOCAL, and Apple Network Framework only. The socket will begin accepting new connections. This is an asynchronous operation. `on_accept_start()` will be invoked when the listener is ready to accept new connection. New connections will arrive via the `on_accept_result()` callback.
741
745
742
746
int aws_socket_stop_accept(struct aws_socket *socket);
743
747
744
-
TCPand LOCAL only. The socket will shutdown the listener. It is safe to call `aws_socket_start_accept()`again after this
745
-
operation.
748
+
TCP, LOCAL, and Apple Network Framework only. The socket will shutdown the listener. It is safe to call `aws_socket_start_accept()`
749
+
again after this operation.
746
750
747
751
int aws_socket_close(struct aws_socket *socket);
748
752
749
753
Calls `close()` on the socket and unregisters all io operations from the event loop.
750
754
755
+
int aws_socket_set_close_complete_callback(struct aws_socket *socket, aws_socket_on_shutdown_complete_fn fn, void *user_data);
756
+
757
+
Sets the close completion callback. The callback will be invoked if `aws_socket_close()` finish to process all the I/O events and close the socket.
0 commit comments