GitHub

DatagramSocketService

API reference for DatagramSocketService.

A UDP socket: acquiring reader in a scope opens and binds a socket (one at a time; another acquisition waits for it to close); writer writes through the open one. make(reader, writer) builds one.

Attributes

AttributeTypeDescription
readerEffect[Reader, DatagramSocketError, Scope]

Opens and binds the socket for the life of the scope and gives its Reader; while one is open, another acquisition waits for its scope to close. Fails with DatagramSocketError when the socket cannot be opened or bound.

writerEffect[Writer, Never, Scope]

The Writer: acquiring it never fails, and its writes wait for an open reader's socket.

Functions

__init__

__init__(reader, writer) -> None
ParameterTypeDescription
readerEffect[Reader, DatagramSocketError, Scope]
writerEffect[Writer, Never, Scope]
def __init__(
    self,
    reader: Effect[Reader, DatagramSocketError, Scope],
    writer: Effect[Writer, Never, Scope],
) -> None:
    require_effect(reader, "reader")
    require_effect(writer, "writer")
    self._reader = reader
    self._writer = writer