How to execute commands one by one - WeOnlyDo Discussion board

How to execute commands one by one (wodSSH / wodSSH.NET)

by lax4u, Tuesday, July 03, 2007, 00:31 (6152 days ago)

How my code should look like if i want to send commands one by one after connected.
I have following code to connect.

public void DoWork()
{

WODTELNETDLXCOMLIB.wodTelnetDLXCom telnet1 = new WODTELNETDLXCOMLIB.wodTelnetDLXCom();
telnet1.Timeout = 30;
telnet1.Connected += new WODTELNETDLXCOMLIB._IwodTelnetDLXComEvents_ConnectedEventHandler(telnet1_Connected);
telnet1.PromptReceived += new WODTELNETDLXCOMLIB._IwodTelnetDLXComEvents_PromptReceivedEventHandler(telnet1_PromptReceived);
telnet1.Disconnected += new WODTELNETDLXCOMLIB._IwodTelnetDLXComEvents_DisconnectedEventHandler(telnet1_Disconnected);

telnet1.Blocking = true;
telnet1.Login = user ;
telnet1.Password = password ;
telnet1.Connect(IPADDRESS, 23, WODTELNETDLXCOMLIB.ProtocolsEnum.Telnet);
if (this.isConnected)
{

// here i want to execute commands one by one. how do i do that.
// when i login i get screen which shows Press any key to continue and i have to hit enter key to goto next screen
// on next screen i get some other text plus prompt Code: where i have to enter command 'DTL' and then enter.
// on next screen i get : where i have to execute command 'sys' to go to unix prompt
// so on...

can somebody show me sequence of code in C# to achieve this.

}

}


Complete thread: