封装的一个套接字----服务端
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.Threading;
namespace EarlyServer
{
public class ConnectClient : IDisposable
{
Member
public ConnectClient(Socket socket, string netWorkName)
{
m_Socket = socket;
m_NetWorkName = netWorkName;
}
Public Methods
Private Methods
event Methods
IDisposable 成员
}
public class ClientData
{
public static Dictionary<string, ConnectClient> List = new Dictionary<string, ConnectClient>();
}
public delegate void CommandReceiveEventHandler(object sender, CommandEventArgs eventArgs);
public class CommandEventArgs : EventArgs
{
private MsgCommand m_MsgCommand;
public MsgCommand Command
{
get { return m_MsgCommand; }
}
public CommandEventArgs(MsgCommand msgCommand)
{
this.m_MsgCommand = msgCommand;
}
}
public class MsgCommand
{
private string commnadString;
/// <summary>
/// 发送者名称
/// </summary>
public string CommnadString
{
get { return commnadString; }
set { commnadString = value; }
}
private string senderName;
/// <summary>
/// 发送者名称
/// </summary>
public string SenderName
{
get { return senderName; }
set { senderName = value; }
}
private string targetName;
/// <summary>
/// 目标名称
/// </summary>
public string TargetName
{
get { return targetName; }
set { targetName = value; }
}
private string commandBody;
/// <summary>
/// 内容
/// </summary>
public string MetaData
{
get { return commandBody; }
set { commandBody = value; }
}
Constructors
}
}
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.Threading;
namespace EarlyServer
{
public class ConnectClient : IDisposable
{
Member
public ConnectClient(Socket socket, string netWorkName)
{
m_Socket = socket;
m_NetWorkName = netWorkName;
}
Public Methods
Private Methods
event Methods
IDisposable 成员
}
public class ClientData
{
public static Dictionary<string, ConnectClient> List = new Dictionary<string, ConnectClient>();
}
public delegate void CommandReceiveEventHandler(object sender, CommandEventArgs eventArgs);
public class CommandEventArgs : EventArgs
{
private MsgCommand m_MsgCommand;
public MsgCommand Command
{
get { return m_MsgCommand; }
}
public CommandEventArgs(MsgCommand msgCommand)
{
this.m_MsgCommand = msgCommand;
}
}
public class MsgCommand
{
private string commnadString;
/// <summary>
/// 发送者名称
/// </summary>
public string CommnadString
{
get { return commnadString; }
set { commnadString = value; }
}
private string senderName;
/// <summary>
/// 发送者名称
/// </summary>
public string SenderName
{
get { return senderName; }
set { senderName = value; }
}
private string targetName;
/// <summary>
/// 目标名称
/// </summary>
public string TargetName
{
get { return targetName; }
set { targetName = value; }
}
private string commandBody;
/// <summary>
/// 内容
/// </summary>
public string MetaData
{
get { return commandBody; }
set { commandBody = value; }
}
Constructors
}
}