using System;
using System.Net.Sockets;

namespace SWRIS.Models
{
    public class ClientState
    {
        public string SerialNo { get; set; }
        public string IpAddress { get; }
        public Socket ClientSocket { get; set; }
        public byte[] Buffer { get; set; }
        public ByteCircularBuffer ReceiveBuffer { get; set; } = new ByteCircularBuffer(32768); // 添加环形缓冲区
        public DateTime LastActiveTime { get; set; } = DateTime.UtcNow;
        public ClientState(Socket clientSocket, string ipAddress, string serialNo)
        {
            ClientSocket = clientSocket;
            IpAddress = ipAddress;
            SerialNo = serialNo;
            Buffer = new byte[8192];
        }
        public ClientState(Socket clientSocket, string ipAddress)
        {
            ClientSocket = clientSocket;
            IpAddress = ipAddress;
            Buffer = new byte[8192];
        }
    }
}
