using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net.Sockets; namespace IStation { /// /// 客户端处理封装类 /// public class TcpClientState { public TcpClientState(TcpClient tcpClient, byte[] buffer) { this.TcpClient = tcpClient; this.Buffer = buffer; } /// /// 与客户端相关的TcpClient /// public TcpClient TcpClient { get; private set; } /// /// 获取缓冲区 /// public byte[] Buffer { get; private set; } /// /// 获取网络流 /// public NetworkStream NetworkStream { get { return TcpClient.GetStream(); } } /// /// 关闭 /// public virtual void Close() { //关闭数据的接受和发送 this.TcpClient.Close(); this.Buffer = null; } } }