private void backgroundWorker_telnet_DoWork(object sender, DoWorkEventArgs e) { while (true) { try { TelnetWrapper t = new TelnetWrapper(); t.Disconnected += new DisconnectedEventHandler(this.telnet_OnDisconnect); t.DataAvailable += new DataAvailableEventHandler(this.telnet_OnDataAvailable); Console.WriteLine("telnet connect to ardrone"); t.Connect("192.168.1.1", 23); Console.WriteLine("telnet send command"); t.Send("/data/video/xtudo\r\n"); t.Send("exit\r\n"); Console.WriteLine("telnet close"); t.Close(); Thread.Sleep(1000); } catch (Exception ex) { Console.WriteLine(ex.Message); } } }