Exemplo n.º 1
0
 public static event ShowMsg OnMessage;//消息来了的委托事件
 /// <summary>
 /// 构造函数,要求有参数
 /// </summary>
 /// <param name="ip"></param>
 /// <param name="port">端口号</param>
 /// <param name="desc">服务器描述</param>
 public TcpServerManager(string ip, ushort port, string desc)
 {
     this.ip            = ip;
     this.port          = port;
     this.desc          = desc;
     server             = new HPSocketCS.TcpServer();
     extra              = new HPSocketCS.Extra <ClientInfo>();
     server.OnAccept   += new HPSocketCS.TcpServerEvent.OnAcceptEventHandler(server_OnAccept);
     server.OnSend     += new TcpServerEvent.OnSendEventHandler(server_OnSend);
     server.OnReceive  += new HPSocketCS.TcpServerEvent.OnReceiveEventHandler(server_OnReceive);
     server.OnClose    += new TcpServerEvent.OnCloseEventHandler(server_OnClose);
     server.OnShutdown += new TcpServerEvent.OnShutdownEventHandler(server_OnShutdown);
     StartServer();
 }