NetworkClient
StockSharp.Fix.Native
Abstract base class for UDP network clients.
Inherits: BaseLogReceiver
Implements: INetworkClient, ILogReceiver, ILogSource, IDisposable, IPacketProcessor
Constructors
NetworkClient
protected NetworkClient(IUdpDialect dialect, string name, MulticastSourceAddress address, Func<TNetworkClient, IMemoryOwner<byte>, List<Message>, bool> processMessage, IPacketReceiverFactory receiverFactory)
networkClient = NetworkClient(dialect, name, address, processMessage, receiverFactory)
Initializes a new instance of the NetworkClient class.
- dialect
- The UDP dialect.
- name
- The client name.
- address
- The multicast source address.
- processMessage
- Function to process received messages.
- receiverFactory
- IPacketReceiverFactory
Properties
Dialect
public IUdpDialect Dialect { get; }
value = networkClient.Dialect
Gets the UDP dialect associated with this client.
FullMode
public PacketQueueFullModes FullMode { get; set; }
value = networkClient.FullMode
networkClient.FullMode = value
Behavior when the packet queue is full.
IsEnabled
public bool IsEnabled { get; }
value = networkClient.IsEnabled
Gets a value indicating whether the client is enabled.
MaxIncomingQueueSize
public int MaxIncomingQueueSize { get; }
value = networkClient.MaxIncomingQueueSize
Maximum buffered incoming UDP packets per feed before new packets are dropped.
MaxUdpDatagramSize
public int MaxUdpDatagramSize { get; }
value = networkClient.MaxUdpDatagramSize
Maximum UDP datagram size.
Methods
AllocatePacket
public IMemoryOwner<byte> AllocatePacket(int size)
result = networkClient.AllocatePacket(size)
To allocate a packet of the specified size.
- size
- The size of the packet to allocate.
Returns: The packet.
Connect
public void Connect()
networkClient.Connect()
Connects the client using the specified serializer.
DisposeManaged
protected override void DisposeManaged()
networkClient.DisposeManaged()
Release resources.
DisposePacket
public void DisposePacket(IMemoryOwner<byte> packet, string reason)
networkClient.DisposePacket(packet, reason)
Disposes the packet with the specified reason.
- packet
- The packet.
- reason
- The specified reason.
ErrorHandler
public void ErrorHandler(Exception e, int numErrors, bool isFatal)
networkClient.ErrorHandler(e, numErrors, isFatal)
Handles errors that occur during packet processing.
- e
- The exception encountered.
- numErrors
- The error count.
- isFatal
- Indicates whether the error is fatal.
ProcessNewPacket
public ValueTask<bool> ProcessNewPacket(IMemoryOwner<byte> packet, int length, CancellationToken cancellationToken)
result = networkClient.ProcessNewPacket(packet, length, cancellationToken)