UdpServer

Ecng.Net

UDP server that relays packets from a source to multicast groups.

继承自: Disposable

方法

DisposeManaged
protected override void DisposeManaged()
udpServer.DisposeManaged()

Disposes the managed resources. Override this method to add custom clean up of managed resources.

ReplayAsync
public ValueTask ReplayAsync(Dictionary<IPEndPoint, double> multicastGroups, IUdpPacketSource packetSource, double speedMultiplier, CancellationToken cancellationToken)
result = udpServer.ReplayAsync(multicastGroups, packetSource, speedMultiplier, cancellationToken)

Replays packets from the source to the configured multicast groups.

multicastGroups
Dictionary of multicast endpoints to packet loss probability (0-1).
packetSource
The source of packets to replay.
speedMultiplier
Speed multiplier (1 = real-time, 2 = 2x speed, 0.5 = half speed, etc.).
cancellationToken
Cancellation token.
SendAsync
public ValueTask SendAsync(IPEndPoint endpoint, ReadOnlyMemory<byte> data, CancellationToken cancellationToken)
result = udpServer.SendAsync(endpoint, data, cancellationToken)

Sends a single packet to the specified endpoint.

endpoint
The target endpoint.
data
The data to send.
cancellationToken
Cancellation token.