Thursday, 15 January 2015

Telnet Minimalistic C# send prompt as two lines, not just as one -



Telnet Minimalistic C# send prompt as two lines, not just as one -

i have text in textbox1 = alusrx 287 tst001

alusrx = script want execute.

287 tst001 = 2 parameters script needs work.

i'm taking 287 textbox2 , taking tst001 textbox3

so created prompt string follow:

("alusrx " + textbox2.text + textbox3.text);

and doesn't work

when send string alusrx 287 tst001 ...it sends 2 lines not 1 instruction line

this happens in server:

:/>alusrx

(enter line, error saying: need other 2 parameters"

:/>287 tst001

(enter line, error saying: obviusly, not ksh found"

but when create string static value in textbox2 (287):

("altausrx " + "287" + textbox3.text);

this happened:

:/>alusrx 287 tst001

it works!

i guess problem i'm taking 287 variable textbox2 , causes break string in 2 lines.

perhaps seek string format.

var command = string.format("allusrx {0} {1}", textbox2.text, textbox3.text)

then pass command in, can check command in debug , create sure formatting way expecting.

c# command-prompt telnet

No comments:

Post a Comment