private void ListenThread() { while (true) { try { listenerSocket.Listen(0); ClientBase client = CreateClient(listenerSocket.Accept()); clientCounter++; clientTable.Add(client, clientCounter); clientFromId.Add(clientCounter, client); client.MessageReceived += Client_MessageReceived; client.ConnectionEnded += Client_ConnectionEnded; ClientConnected?.Invoke(this, new ClientConnectedEventArgs(client, clientCounter)); } catch (SocketException) { ListenerClosed?.Invoke(this, new EventArgs()); return; } } }
public void CloseSubscriber() { using (log.Block()) { subscriberHosts.ForEach(host => host.Close()); subscriberHosts.Clear(); } ListenerClosed?.Invoke(); }
private void OnListenerClosed(Listener listener) { ListenerClosed?.Invoke(this, listener); }