Skip to content

StormUdpClient — connectionless UDP client #17

@suleymanbyzt

Description

@suleymanbyzt

Client counterpart to StormUdpServer (#16). UDP clients don't establish a connection in the TCP sense — they just send and receive datagrams to/from a target endpoint.

Proposed API

var client = new StormUdpClient(new UdpClientOptions
{
    EndPoint = new IPEndPoint(IPAddress.Loopback, 9000),
});

client.OnDataReceived += async data =>
{
    Console.WriteLine($"Received: {data.Length} bytes");
};

client.OnError += async ex =>
{
    Console.WriteLine($"Error: {ex.Message}");
};

await client.StartAsync();
await client.SendAsync(payload);

// Cleanup
await client.DisposeAsync();

Design

  • Socket.SendToAsync / Socket.ReceiveAsync — no Pipes, no framing
  • Events: OnDataReceived, OnError
  • No auto-reconnect — UDP is connectionless, no connection to lose
  • No framing — each datagram is a complete message
  • Middleware support via UseMiddleware()
  • Metrics tracking (BytesSent, BytesReceived, DatagramsSent, DatagramsReceived)

UdpClientOptions

Property Type Default Description
EndPoint IPEndPoint 127.0.0.1:9000 Target server endpoint
ReceiveBufferSize int 65536 OS socket receive buffer
SendBufferSize int 65536 OS socket send buffer
DualMode bool false IPv4/IPv6 dual-stack
ReuseAddress bool false SO_REUSEADDR

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions