예제 #1
0
        /// <summary>
        /// 初始化Peer
        /// </summary>
        /// <param name="socket">连接的Socket</param>
        public Peer(Socket socket)
        {
            this.socket      = socket;
            this.NS          = new NetworkStream(socket);
            this.Information = new PeerInformation(socket.RemoteEndPoint);
            peers.Add(this);
            this.addInto(Group.BroadCast);
            this.isActive = true;
            Thread t = new Thread(new ThreadStart(ReceiveProcess));

            t.IsBackground = true;
            t.Start();
        }
예제 #2
0
 /// <summary>
 /// 初始化Peer
 /// </summary>
 /// <param name="socket">连接的Socket</param>
 public Peer(Socket socket)
 {
     this.socket = socket;
     this.NS = new NetworkStream(socket);
     this.Information = new PeerInformation(socket.RemoteEndPoint);
     peers.Add(this);
     this.addInto(Group.BroadCast);
     this.isActive = true;
     Thread t = new Thread(new ThreadStart(ReceiveProcess));
     t.IsBackground = true;
     t.Start();
 }