Instance Method
accept()
Awaits and returns a single incoming TCP connection.
func accept() async throws -> Socket
Return Value
A connected Socket for the newly-accepted client.
Mentioned In
Discussion
Registers a one-shot EV_READ event on the listening descriptor, drives the event loop via runOnce(), then calls accept(2) in the ready callback. The returned Socket owns its descriptor and is configured for non-blocking I/O; read/write it via the normal read(maxBytes:) / write(_:) APIs.
Throws
SocketError.acceptFailed(_:) if accept(2) returns a negative value.
See Also
connections for a streaming alternative.