Gio.Socket.prototype.accept
function accept(cancellable: Gio.Cancellable): Gio.Socket { // Gjs wrapper for g_socket_accept() }
Accept incoming connections on a connection-based socket. This removes the first outstanding connection request from the listening socket and creates a Gio.Socket object for it.
The socket must be bound to a local address with Gio.Socket.prototype.bind and must be listening for incoming connections (Gio.Socket.prototype.listen).
If there are no outstanding connections then the operation will block or return Gio.IOErrorEnum.would_block if non-blocking I/O is enabled. To be notified of an incoming connection, wait for the GLib.IOCondition.in condition.
Since 2.22
- cancellable
a %GCancellable or null
- Returns
a new Gio.Socket, or null on error. Free the returned object with GObject.Object.prototype.unref.