using System.Net.Sockets; namespace JiLinApp.Docking.VibrateAlarm; public class TcpClientState { /// /// Constructor for a new Client /// /// The TCP client /// The byte array buffer public TcpClientState(TcpClient client, byte[] buffer) { if (client == null) throw new ArgumentNullException("tcpClient"); if (buffer == null) throw new ArgumentNullException("buffer"); Client = client; Buffer = buffer; Temp = string.Empty; } /// /// Gets the TCP Client /// public TcpClient Client { get; private set; } /// /// Gets the Buffer. /// public byte[] Buffer { get; private set; } /// /// TCP接收到但未处理的数据 /// public string Temp { get; set; } /// /// Gets the network stream /// public NetworkStream GetStream { get { NetworkStream stream = Client.GetStream(); stream.ReadTimeout = 5000; stream.WriteTimeout = 5000; return stream; } } public bool IsRead { get; set; } public object IsReadLock { get; } = new(); }