示例#1
0
 public void Write(string remoteAddress, string msg)
 {
     for (int i = 0; i < this.clients.Count; i++)
     {
         ClientThread thread = (ClientThread)this.clients[i];
         //if (thread.RemoteAddress.Equals(remoteAddress))
         //{
         thread.Write(msg);
         return;
         //}
     }
 }
示例#2
0
 private void Listen()
 {
     this.server.Listen(10);
     while (this.isRun)
     {
         Socket client = this.server.Accept();
         client.Blocking = true;
         ClientThread thread = new ClientThread(this, client);
         thread.OnReceive    += this.OnReceive;
         thread.OnDisconnect += this.OnDisconnect;
         this.clients.Add(thread);
         if (this.OnConnect != null)
         {
             this.OnConnect(this, new SocketEventArgs(client));
         }
         thread.Start();
     }
 }
示例#3
0
 internal void RemoveClient(ClientThread client)
 {
     this.clients.Remove(client);
 }
示例#4
0
 private void Listen()
 {
     this.server.Listen(10);
     while (this.isRun)
     {
         Socket client = this.server.Accept();
         client.Blocking = true;
         ClientThread thread = new ClientThread(this, client);
         thread.OnReceive += this.OnReceive;
         thread.OnDisconnect += this.OnDisconnect;
         this.clients.Add(thread);
         if (this.OnConnect != null)
         {
             this.OnConnect(this, new SocketEventArgs(client));
         }
         thread.Start();
     }
 }
示例#5
0
 internal void RemoveClient(ClientThread client)
 {
     this.clients.Remove(client);
 }