IPacketProcessor
Ecng.Net
Interface for packet processor that handles received packets.
Properties
MaxIncomingQueueSize
public int MaxIncomingQueueSize { get; }
value = iPacketProcessor.MaxIncomingQueueSize
Gets or sets the maximum incoming queue size.
MaxUdpDatagramSize
public int MaxUdpDatagramSize { get; }
value = iPacketProcessor.MaxUdpDatagramSize
Gets or sets the maximum UDP datagram size.
Methods
AllocatePacket
public IMemoryOwner<byte> AllocatePacket(int size)
result = iPacketProcessor.AllocatePacket(size)
Allocates a packet buffer.
- size
- The size of the buffer.
Returns: The allocated memory.
DisposePacket
public void DisposePacket(IMemoryOwner<byte> packet, string reason)
iPacketProcessor.DisposePacket(packet, reason)
Disposes the packet with the specified reason.
- packet
- The packet.
- reason
- The reason for disposal.
ErrorHandler
public void ErrorHandler(Exception ex, int errorCount, bool isFatal)
iPacketProcessor.ErrorHandler(ex, errorCount, isFatal)
Handles errors that occur during packet processing.
- ex
- The exception.
- errorCount
- The current error count.
- isFatal
- Whether the error is fatal.
ProcessNewPacket
public ValueTask<bool> ProcessNewPacket(IMemoryOwner<byte> packet, int length, CancellationToken cancellationToken)
result = iPacketProcessor.ProcessNewPacket(packet, length, cancellationToken)
Processes a new packet.
- packet
- The packet data.
- length
- The packet length.
- cancellationToken
- Cancellation token.
Returns: True to continue processing, false to stop.