You can use ReceiveData() for reading line which doesn't end with a new-line character.
It just returns current content of the internal buffer.
Small delay by System.Threading.Thread.Sleep() before ReceiveData() will help to buffer the line.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I use both ReceiveData() and ReceiveData(delay). if I force call ReceiveData(delay) 100 times, it doesn't read anything in lastline. I'll try the beta 14.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
conn.ReceiveData(100) would give the expected result here.
ReceiveLine(t) waits for the end of line until the timeout.
If a new-line code was not detected, ReceiveLine(t) returns null
even if other data exist in the internal buffer.
var op = conn.ReceiveLine();
There is no need to change this first ReceiveLine().
This line will read echo back of the text you sent.
To check the value of the variable, trace window will help.
var env = new Poderosa.Macro.Environment();
env.Debug.ShowTraceWindow();
:
env.Debug.Trace('op = ' + op);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Help,
Poderosa macro ReceiveLine(), never get last line. sample below:
host# show date
2015/05/16
host#
--> the ReceiveLine() method never get the 2nd "host#"
host# ssh host2
password:
--> the ReceiveLine() method never reach the "password:"
Thank you
You can use ReceiveData() for reading line which doesn't end with a new-line character.
It just returns current content of the internal buffer.
Small delay by System.Threading.Thread.Sleep() before ReceiveData() will help to buffer the line.
I use both ReceiveData() and ReceiveData(delay). if I force call ReceiveData(delay) 100 times, it doesn't read anything in lastline. I'll try the beta 14.
this problem still exist in beta 14
this my code:
conn.TransmitLn("ssh " + l[0] + "@" + host[0]);
op = ReceivePrompt(sw);
if(op.Contains('(yes/no)?'))
{
conn.TransmitLn("yes");
op = ReceivePrompt(sw);
}
if(op.Contains("password:"))
conn.TransmitLn(l[1]);
function ReceivePrompt(sw)
{
var prompt = /\n[%$>#] $/;
var op = conn.ReceiveLine();
var ok = true;
var failCount = 0;
}
conn.ReceiveData(100) would give the expected result here.
ReceiveLine(t) waits for the end of line until the timeout.
If a new-line code was not detected, ReceiveLine(t) returns null
even if other data exist in the internal buffer.
There is no need to change this first ReceiveLine().
This line will read echo back of the text you sent.
To check the value of the variable, trace window will help.