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; }
public OnConnectEventArgs(Mp3Streamer streamer, TcpClient client) { this.streamer = streamer; this.client = client; }