hydra-node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Events.UDPSpec

Description

Tests for the UDP example event sink.

Synopsis

Documentation

spec :: Spec Source #

withUDPServerSocket :: (ListenSocket -> PortNumber -> IO a) -> IO a Source #

Bind a UDP server socket on any free port and hand the assigned port to the action. Binding port 0 directly avoids probing for a free port with a separate socket, which is racy (and the previous TCP probe said nothing about UDP availability anyway).

Everything here is on 127.0.0.1 rather than 0.0.0.0 deliberately: a datagram sent to 0.0.0.0 only reaches the local host on Linux, and fails with EHOSTUNREACH on macOS.