예제 #1
0
 protected virtual void SendSpecific(Client[] specificClients, byte[] p)
 {
     for (int i = 0; i < specificClients.Length; i++)
     {
         specificClients[i].Send(p);
     }
 }
예제 #2
0
        private void AsyncListen()
        {
            while (true)
            {
                Socket client = listener.Accept();
                byte key = (byte)rand.Next(1, 255);
                Client serverClient = new Client(client, key);
                clients.Add(serverClient);

                OnClientConnected(new ClientConnectionEventArgs(serverClient));
                serverClient.ClientExceptionOccoured += new EventHandler<ClientExceptionEventArgs>(serverClient_ClientExceptionOccoured);
                serverClient.ClientDisposed += new EventHandler(serverClient_ClientDisposed);

                serverClient.BeginReceive();
            }
        }