eve.aio.windows.udp
Async UDP datagram socket primitives for Windows.
This module provides the Windows implementation of UDP networking primitives using Winsock2 API.
UDP is message-oriented: each send/receive operates on complete datagrams. Unlike TCP, there is no connection state or backpressure mechanism.
Types 3
structUdpSocketConfig
UDP socket configuration.
Fields
size_t maxDatagramSizeMaximum datagram size for receive buffer.bool reuseAddrEnable SO_REUSEADDR on bind.bool broadcastEnable SO_BROADCAST for sending broadcast messages.Methods
structSocketAddress
Represents a remote endpoint address.
Fields
ushort familyAddress family (AF_INET or AF_INET6).ushort portPort number in host byte order.ubyte[4] ipv4IPv4 address bytes (only valid if family == AF_INET).ubyte[16] ipv6IPv6 address bytes (only valid if family == AF_INET6).structUdpSocket
Async UDP socket wrapper.
Wraps a non-blocking UDP socket and integrates with the Layer 1 event loop for async send/receive operations.
Methods
UdpSocket create(UdpSocketConfig config = UdpSocketConfig.init) static @trustedCreate a detached UDP socket wrapper.void onData(DataCallback callback) @property @trusted Set the data received callback. Fires when a datagram arrives. The `data` parameter is borrowed — valid only for the duration of the callback. Copy it if needed beyond. Thread affinity: even...int lastError() @property const @safe nothrow @nogcGet the last error recorded by a socket operation.int bind(ref EventLoop loop, scope const(char)[] host, ushort port) @trustedBind the socket to a local endpoint.DatagramStatus sendTo(scope const(ubyte)[] data, scope const(char)[] host, ushort port) @trustedSend a datagram to a specific destination.DatagramStatus sendToAddress(scope const(ubyte)[] data, SocketAddress dest) @trusted Send a datagram to a specific destination address. In WSAPoll mode, data is borrowed directly by the OS sendto call (Borrow semantics). In IOCP overlapped mode, data is copied into an internal...