Ejemplo n.º 1
0
        public void callback()
        {
            try
            {
                TcpClient client = listener.AcceptTcpClient();
                ClientAccept?.Invoke(client);
                thread = new Thread(callback);
                thread.Start();

                //Socket s = this.s.EndAccept(ar);
                //SocketAccepted?.Invoke(s);
                //this.s.BeginAccept(callback, null);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 当接收到客户端连接时
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnClientAccepted(EventArgs e)
 {
     ClientAccept?.Invoke(this, e);
 }