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