Represents a TCP server socket, managing incoming client connections.
- ofNative :: (
- native : Internal.UV.TCP.Socket
- )
Instances For
Represents a TCP client socket, used to connect to a server.
- ofNative :: (
- native : Internal.UV.TCP.Socket
- )
Instances For
Creates a new TCP server socket.
Equations
- Std.Async.TCP.Socket.Server.mk = do let native ← Std.Internal.UV.TCP.Socket.new pure { native := native }
Instances For
Binds the server socket to the specified address. Address reuse is enabled to allow rebinding the same address.
Instances For
Accepts an incoming connection.
Equations
Instances For
Tries to accept an incoming connection.
Equations
- s.tryAccept = do let res ← s.native.tryAccept let socket ← IO.ofExcept res pure (Std.Async.TCP.Socket.Client.ofNative✝ <$> socket)
Instances For
Creates a Selector that resolves once s has a connection available. Calling this function
does not start the connection wait, so it must not be called in parallel with accept.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Gets the local address of the server socket.
Equations
Instances For
Enables TCP keep-alive for all client sockets accepted by this server socket.
Equations
Instances For
Creates a new TCP client socket.
Equations
- Std.Async.TCP.Socket.Client.mk = do let native ← Std.Internal.UV.TCP.Socket.new pure { native := native }
Instances For
Binds the server socket to the specified address. Address reuse is enabled to allow rebinding the same address.
Instances For
Connects the client socket to the given address.
Equations
- s.connect addr = Std.Async.Async.ofPromise (s.native.connect addr)
Instances For
Sends multiple data buffers through the client socket. Throws an IO.Error.invalidArgument if a
buffer is 4 GiB or larger.
Equations
- s.sendAll data = Std.Async.Async.ofPromise (s.native.send data)
Instances For
Sends data through the client socket. Throws an IO.Error.invalidArgument if data is 4 GiB or
larger.
Instances For
Receives data from the client socket. If data is received, it’s wrapped in .some. If EOF is reached,
the result is .none, indicating no more data is available. Receiving data in parallel on the same
socket is not supported. Instead, we recommend binding multiple sockets to the same address.
Furthermore calling this function in parallel with recvSelector is not supported.
Throws an IO.Error.invalidArgument if size is 0 or at least 4 GiB.
Equations
- s.recv? size = Std.Async.Async.ofPromise (s.native.recv? size)
Instances For
Creates a Selector that resolves once s has data available, up to at most size bytes,
and provides that data. Calling this function does not starts the data wait, so it must not be called
in parallel with recv?. Fails with an IO.Error.invalidArgument if size is 0 or at least 4 GiB,
like recv?.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Shuts down the write side of the client socket.
Equations
Instances For
Closes the client socket. Pending operations fail, and so does every later one. Writes still in flight are cancelled, so the peer may receive only part of them. Closing twice does nothing.
Instances For
Gets the remote address of the client socket.
Equations
Instances For
Gets the local address of the client socket.
Equations
Instances For
Enables TCP keep-alive with a specified delay for the client socket.