2020-02-11 17:44:06 -05:00
|
|
|
|
using System;
|
2020-04-17 16:05:16 -04:00
|
|
|
|
using System.Collections.Generic;
|
2020-02-11 17:44:06 -05:00
|
|
|
|
using System.Net.Sockets;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
2021-06-03 11:51:03 -04:00
|
|
|
|
namespace Integrations.Cod
|
2020-02-11 17:44:06 -05:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// used to keep track of the udp connection state
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal class ConnectionState
|
|
|
|
|
{
|
|
|
|
|
~ConnectionState()
|
|
|
|
|
{
|
|
|
|
|
OnComplete.Dispose();
|
|
|
|
|
OnSentData.Dispose();
|
|
|
|
|
OnReceivedData.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int ConnectionAttempts { get; set; }
|
2021-01-17 21:04:32 -05:00
|
|
|
|
private const int BufferSize = 16384;
|
2020-02-11 17:44:06 -05:00
|
|
|
|
public readonly byte[] ReceiveBuffer = new byte[BufferSize];
|
|
|
|
|
public readonly SemaphoreSlim OnComplete = new SemaphoreSlim(1, 1);
|
|
|
|
|
public readonly ManualResetEventSlim OnSentData = new ManualResetEventSlim(false);
|
|
|
|
|
public readonly ManualResetEventSlim OnReceivedData = new ManualResetEventSlim(false);
|
2020-04-17 16:05:16 -04:00
|
|
|
|
public List<int> BytesReadPerSegment { get; set; } = new List<int>();
|
2020-02-11 17:44:06 -05:00
|
|
|
|
public SocketAsyncEventArgs SendEventArgs { get; set; } = new SocketAsyncEventArgs();
|
|
|
|
|
public SocketAsyncEventArgs ReceiveEventArgs { get; set; } = new SocketAsyncEventArgs();
|
|
|
|
|
public DateTime LastQuery { get; set; } = DateTime.Now;
|
|
|
|
|
}
|
2021-06-03 11:51:03 -04:00
|
|
|
|
}
|