Exemple #1
0
        private void StartTask(object nothing)
        {
            mThread       = Thread.CurrentThread;
            threadRunning = true;

            isRunning = true;
            listener.Start();
            while (isRunning)
            {
                CleanStreamerList();
                TcpClient tcpClient;
                try
                {
                    if (listener.Pending())
                    {
                        tcpClient = listener.AcceptTcpClient();
                        Mp3Streamer streamer = new Mp3Streamer(tcpClient);
                        streamerList.Add(streamer);

                        if (OnConnected != null)
                        {
                            OnConnected(this, new OnConnectEventArgs(streamer, tcpClient));
                        }
                    }
                    else
                    {
                        Thread.Sleep(1000);
                    }
                }
                catch (SocketException e)
                {
                    continue;
                }
            }
            threadRunning = false;
        }
Exemple #2
0
 public OnConnectEventArgs(Mp3Streamer streamer, TcpClient client)
 {
     this.streamer = streamer;
     this.client   = client;
 }