Class NetworkClient<TNetworkClient>
- Namespace
- StockSharp.Fix.Native
- Assembly
- StockSharp.Udp.Core.dll
Abstract base class for UDP network clients.
[CLSCompliant(false)]
public abstract class NetworkClient<TNetworkClient> : BaseLogReceiver, IPersistable, INetworkClient, ILogReceiver, ILogSource, IDisposable where TNetworkClient : NetworkClient<TNetworkClient>
Type Parameters
TNetworkClientThe concrete network client type.
- Inheritance
-
NetworkClient<TNetworkClient>
- Implements
- Inherited Members
- Extension Methods
Constructors
NetworkClient(IUdpDialect, string, MulticastSourceAddress, Func<TNetworkClient, IMemoryOwner<byte>, bool>)
Initializes a new instance of the NetworkClient<TNetworkClient> class.
protected NetworkClient(IUdpDialect dialect, string name, MulticastSourceAddress address, Func<TNetworkClient, IMemoryOwner<byte>, bool> processMessage)
Parameters
dialectIUdpDialectThe UDP dialect.
namestringThe client name.
addressMulticastSourceAddressThe multicast source address.
processMessageFunc<TNetworkClient, IMemoryOwner<byte>, bool>Function to process received messages.
Properties
Dialect
Gets the UDP dialect associated with this client.
public IUdpDialect Dialect { get; }
Property Value
IsEnabled
Gets a value indicating whether the client is enabled.
public bool IsEnabled { get; }
Property Value
Name
Gets the client name.
public override string Name { get; }
Property Value
Methods
AllocatePacket(int)
To allocate a packet of the specified size.
public IMemoryOwner<byte> AllocatePacket(int size)
Parameters
sizeintThe size of the packet to allocate.
Returns
- IMemoryOwner<byte>
The packet.
Connect()
Connects the client using the specified serializer.
public void Connect()
Disconnect()
Disconnects the client.
public void Disconnect()
DisposeManaged()
Disposes the managed resources. Override this method to add custom clean up of managed resources.
protected override void DisposeManaged()
DisposePacket(IMemoryOwner<byte>, string)
Disposes the packet with the specified reason.
public void DisposePacket(IMemoryOwner<byte> packet, string reason)
Parameters
packetIMemoryOwner<byte>The packet.
reasonstringThe specified reason.
ErrorHandler(Exception, int, bool)
Handles errors that occur during packet processing.
public void ErrorHandler(Exception e, int numErrors, bool isFatal)
Parameters
eExceptionThe exception encountered.
numErrorsintThe error count.
isFatalboolIndicates whether the error is fatal.
ProcessNewPacket(IMemoryOwner<byte>)
public bool ProcessNewPacket(IMemoryOwner<byte> packet)
Parameters
packetIMemoryOwner<byte>