Class SinglePacketTransport
- Namespace
- VpnHood.Net.PacketTransports
- Assembly
- VpnHood.Net.PacketTransports.dll
Provides a packet transport that queues sent packets and hands them to the derived class one at a time, through SendPacketAsync(IpPacket), on a sending loop of its own.
public abstract class SinglePacketTransport : PacketTransportBase, IPacketTransport, IDisposable
- Inheritance
-
SinglePacketTransport
- Implements
- Inherited Members
Constructors
SinglePacketTransport(PacketTransportOptions)
Provides a packet transport that queues sent packets and hands them to the derived class one at a time, through SendPacketAsync(IpPacket), on a sending loop of its own.
protected SinglePacketTransport(PacketTransportOptions options)
Parameters
optionsPacketTransportOptionsThe queue's capacity, blocking and packet disposal.
Exceptions
- ArgumentOutOfRangeException
The blocking timeout is negative or too long, or the queue's capacity is not above zero.
Methods
SendPacketAsync(IpPacket)
Sends one packet. A throw drops the packet, so do not throw after handing it on.
protected abstract ValueTask SendPacketAsync(IpPacket ipPacket)
Parameters
ipPacketIpPacketThe packet.
Returns
- ValueTask
A task that represents the asynchronous operation.
Exceptions
- ArgumentOutOfRangeException
The blocking timeout is negative or too long, or the queue's capacity is not above zero.
SendPacketsAsync(IReadOnlyList<IpPacket>)
Hands the batch's one packet to SendPacketAsync(IpPacket).
protected override sealed ValueTask SendPacketsAsync(IReadOnlyList<IpPacket> ipPackets)
Parameters
ipPacketsIReadOnlyList<IpPacket>The batch: empty, or one packet.
Returns
- ValueTask
A task that represents the asynchronous operation.
Exceptions
- ArgumentOutOfRangeException
The batch holds more than one packet.