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); } } }
public void InteractiveSession() { int i; char ch; try { t.Receive(); while (!done) { t.Send(Console.ReadLine() + t.CRLF); } } catch { t.Disconnect(); throw; } }
private void M() { t = new TelnetWrapper(); t.Disconnected += OnDisconnect; t.DataAvailable += OnDataAvailable; t.TerminalType = "NETWORK-VIRTUAL-TERMINAL"; t.Hostname = "pnakotus"; t.Port = 23; t.Connect(); t.Receive(); t.Send(string.Concat("lftp", t.CR)); t.Send(string.Concat("open 192.168.1.110", t.CR)); t.Send(string.Concat("user xbox xbox", t.CR)); t.Send(string.Concat("cd /Hdd1/Apps", t.CR)); t.Send(string.Concat(@"put /mnt/HD_a2/x360/dlc/Nier\ -\ The\ World\ of\ Recycled\ Vessel\ DLC\ XBOX360/535107E8/00000002/B5849AE068830A162D28A72C2E07667A19BCD61853", t.CR)); t.Send(string.Concat("exit", t.CR)); t.Send(string.Concat("exit", t.CR)); Console.ReadLine(); }