Expect and Process methods

0 votes
asked Dec 12, 2013 by Chew (370 points)
edited Dec 12, 2013

Is there any way to capture data on a virtualterminal other than Expect and Process ?

If not, can you provide me with ways to utilize each method ?

This is the code I'm using to kick off my virtualterminal:

telnet = new Telnet(aixServerName, port);
telnet.LogWriter = new Rebex.FileLogWriter("./MyLog.log", Rebex.LogLevel.Verbose);
vt = telnet.StartVirtualTerminal();

Thanks !


2 Answers

0 votes
answered Dec 12, 2013 by Chew (370 points)
edited Dec 12, 2013

I've thought about using Ssh and would like to do something like this:

socket = new Socket(server, port);
inCmd = new BufferedReader(new InputStreamReader(socket.getInputStream()));
outCmd = new PrintWriter(socket.getOutputStream());

This is Java but can't find a way to do something similar in C# with Rebex. This is not an FTP. I want to send/receive commands on a remote host (like unix/Linux) and read streams byte by byte.


0 votes
answered Dec 12, 2013 by Lukas Matyska (59,010 points)
edited Dec 12, 2013

May be ShellChannel class can meet your requirements well. It is very easy to get it:

IShellChannelFactory telnet = new Telnet(server, port);
ShellChannel channel = telnet.CreateShellChannel(new TerminalOptions(), 80, 24);

Using ShellChannel class you can use Receive/Send methods to read/send data from/to the server.