Example #1
0
        private void ListenerCycle()
        {
            try
            {
                while (true) // Listener.Stop() will stop it.
                {
                    var client = new P3DPlayer(Listener.AcceptSocket(), this);
                    client.Ready        += OnClientReady;
                    client.Disconnected += OnClientLeave;
                    client.StartListening();

                    lock (JoiningClients)
                        JoiningClients.Add(client);
                }
            }
            catch (Exception e) when(e is SocketException)
            {
            }
        }