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 { } }
public void Write(GlowContainer glow) { var output = CreateOutput(); glow.Encode(output); output.Finish(); }