Пример #1
0
        void AcceptCallback(IAsyncResult result)
        {
            var listener = (TcpListener)result.AsyncState;

             try
             {
            var socket = listener.EndAcceptSocket(result);
            var client = new Client(socket, this);

            lock(_sync)
               _clients.Add(client);

            if(_glow != null)
            {
               var glowOutPut = new GlowOutput(0, (_, e) => socket.Send(e.FramedPackage));

               using(glowOutPut)
               {
                  _glow.Encode(glowOutPut);

                  glowOutPut.Finish();
               }
            }

            listener.BeginAcceptSocket(AcceptCallback, listener);
             }
             catch
             {
             }
        }
Пример #2
0
 public void RemoveClient(Client client)
 {
     lock(_sync)
     _clients.Remove(client);
 }