probably problems with buffer - WeOnlyDo Discussion board

probably problems with buffer (General questions)

by spettroelica, Thursday, December 28, 2006, 15:57 (6540 days ago)

Goodmorning,

Firstly sorry for my bad english!

I'm usig trial version of wodSSH in a Visual Basic .NET Windows Application.
I don't know Unix absolutely but I'm a .NET developer so a friend of mine has given to me a Unix command to execute on the Unix server and show the answer on a textbox.

If I go to the Server with the client Putty and I execute this command the answer is:

Calls Voice Service Caller Dialed
Channel Today Service Status Input Digits
0 0 *Manoos
1 26 *On Hook
2 26 *On Hook
3 26 *On Hook
4 26 *On Hook
5 26 *On Hook
[...]
120 25 *On Hook
121 25 *On Hook
122 25 *On Hook
123 26 *On Hook
124 26 *On Hook
125 26 *On Hook
126 26 *On Hook
127 26 *On Hook


Otherwise if I execute this command from my Windows Application using wodSSH the answer is limited to the row 104 (not complete) as follow:

Calls Voice Service Caller Dialed
Channel Today Service Status Input Digits
0 0 *Manoos
1 26 *On Hook
2 26 *On Hook
3 26 *On Hook
4 26 *On Hook
5 26 *On Hook
[...]
100 26 *On Hook
101 25 *On Hook
102 25 *On Hook
103 25 *On Hook
104 25 *On


Whats the problem?
How can I resolve it?

HELP ME!!!

Thanks.

Re: probably problems with buffer

by woddrazen, Thursday, December 28, 2006, 16:27 (6540 days ago) @ spettroelica

Hi Paolo,


Can you try something like this:
--------------------------------------------
ssh1.Hostname = your_hostname
ssh1.Login = your_login
ssh1.Password = your_password
ssh1.Blocking = True
ssh1.Connect()

ssh1.WaitFor( regex:[\$ #>] $ )
ssh1.DataReady = 0
TextBox1.Text = TextBox1.Text + (ssh1.Execute( YOUR COMMAND + vbLf, regex:[\$ #>] $ , 30))
--------------------------------------------

More help for Execute Method you can find here:
http://www.weonlydo.com/SSH.NET/Help/WeOnlyDo.Client.SSH.Execute_overload_1.html

Let us know how it goes.


Regards,
Drazen

Re: probably problems with buffer

by spettroelica, Thursday, December 28, 2006, 17:39 (6539 days ago) @ woddrazen

Hi,

thanks for your answer.

In my Form I wrote:

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs)
Handles Button1.Click

ssh1.Authentication = WODSSHLib.AuthenticationsEnum.authPassword
ssh1.Hostname = <MYSERVER>
ssh1.Login = <MYLOGIN>
ssh1.Password = <MYPASSWORD>
ssh1.Command = shmview -sysmon + Chr(10)
ssh1.Protocol = WODSSHLib.ProtocolsEnum.SSH2
ssh1.Connect()
End Sub

Private Sub ssh1_Received(ByVal sender As Object,
ByVal e As AxWODSSHLib._IwodSSHEvents_ReceivedEvent)
Handles ssh1.Received

Dim arrReceived() As String
arrReceived = Split(ssh1.Receive.ToString(), Chr(10))
Dim st As String
TextBox1.Text =
For Each st In arrReceived
TextBox1.Text = TextBox1.Text + st + vbCrLf
Next
ssh1.Disconnect()
End Sub


but the result is what I exposed in my first post.
With your code I have not answer.

:-(


Re: probably problems with buffer

by woddrazen, Thursday, December 28, 2006, 17:55 (6539 days ago) @ spettroelica

Paolo,


I'm not sure why it isn't working because I cannot send your command on our server.

Why don't you try with Execute Method instead using Command Method.

Here is complete sample:
-------------------------------------------------------
ssh1.Protocol = WODSSHCOMLib.ProtocolsEnum.SSH2
ssh1.Hostname = your.hostname
ssh1.Login = your.login
ssh1.Password = your.password
ssh1.Blocking = True
ssh1.Connect()

ssh1.WaitFor( regex:[\$ #>] $ )
ssh1.DataReady = 0
TextBox1.Text = TextBox1.Text + (ssh1.Execute( shmview -sysmon + vbLf, regex:[\$ #>] $ , 30))
-------------------------------------------------------

Let us know how it goes.


Drazen

Re: probably problems with buffer

by spettroelica, Tuesday, January 02, 2007, 09:56 (6535 days ago) @ woddrazen

Goodmorning and Happy New Year!

Sorry the late but I'm not at work for my holiday.

Ok.

I tried your code but at the command

ssh1.WaitFor( regex:[$ #>] $ )

the application wait some seconds and after has a timeout error.

Maybe the problem is about the prompt regex:[$ #>] $ but I don't know Unix so I can't understand if this prompt is the same of my system.

How can I verify it?

Thanks.

Re: probably problems with buffer

by woddrazen, Tuesday, January 02, 2007, 11:23 (6535 days ago) @ spettroelica

Hans,


When you connect to server and before you send some command you will receive prompt.
Here is my prompt that I receive when I connect to my server:

drazen@debian:~$

You can check out prompt in putty and us it as a prompt in your code.

Here is how I successfully use it:
[code]
ssh1.WaitFor( drazen@debian:~$ )
ssh1.DataReady = 0
TextBox1.Text = TextBox1.Text + (ssh1.Execute( ls -al + vbLf, drazen@debian:~$ , 30))
[/code]

Let us know how it goes.


Regards,
Drazen

Re: probably problems with buffer

by spettroelica, Tuesday, January 02, 2007, 11:58 (6535 days ago) @ woddrazen

Hello,

this is what I can see on Putty after Logon:

login as: presidio
presidio@10.41.54.11's password:
Last login: Tue Jan 2 11:03:58 2007 from noc-mi-11.sky.l

Avaya IR JumpStart NET Installation
Installation Date: Thursday January 27 16:41:45 MST 2005


Avaya IR JumpStart NET Installation
Installation Date: Thursday January 27 16:41:45 MST 2005


*********** NOTICE ***************

Last complete backup done on Mon Jan 1 06:13:17 MET 2007

Last partial backup done on Thu Dec 21 11:22:41 MET 2006

It is recommended to perform a full system backup every 30 days.
If you fail to do so, you risk losing information on the system
in the event of a catastrophe.

*********** NOTICE ***************
TERM=[xterm]?


My propmpt is TERM=[xterm]? ?

Thanks.

Re: probably problems with buffer

by woddrazen, Tuesday, January 02, 2007, 12:46 (6535 days ago) @ spettroelica

Hans,


Yes, this is probably your prompt. When command is executed did you receive same prompt?
[code]
ssh1.WaitFor( TERM=[xterm]? ) //first prompt before command is executed
ssh1.DataReady = 0
TextBox1.Text = TextBox1.Text + (ssh1.Execute( shmview -sysmon + vbLf, here goes prompt after command is executed , 30))
[/code]

If problem persist any chance that we can connect to your server and try to resolve your problem? You can send your private information to techsupport@weonlydo.com


Drazen

Re: probably problems with buffer

by spettroelica, Tuesday, January 02, 2007, 17:30 (6534 days ago) @ woddrazen

Hi,

In my last post I've sent what Putty show after Logon but it was not correct.
Here you are the correct version to execute ls commad:


login as: presidio
presidio@10.41.54.11's password:
Last login: Tue Jan 2 14:08:53 2007 from networkdba.sky.

Avaya IR JumpStart NET Installation
Installation Date: Thursday January 27 16:41:45 MST 2005


Avaya IR JumpStart NET Installation
Installation Date: Thursday January 27 16:41:45 MST 2005


*********** NOTICE ***************

Last complete backup done on Mon Jan 1 06:13:17 MET 2007

Last partial backup done on Thu Dec 21 11:22:41 MET 2006

It is recommended to perform a full system backup every 30 days.
If you fail to do so, you risk losing information on the system
in the event of a catastrophe.

*********** NOTICE ***************
TERM=[xterm]? ls

************NOTICE************

AVAYA PROVIDED HARDWARE

************NOTICE************

oppvmi-ir1.sky.local(presidio) ls
MiIR1-07.txt grep.txt myCatmi1.txt pkginfo06022006
ch.txt ivrstatus noc_ir_check vxml2013005.ds
egrep.txt myCat-MI1.txt noc_ir_log
giorno.txt myCat.txt nor_ir_log
oppvmi-ir1.sky.local(presidio)

As you can see after logon the prompt is TERM=[xterm]? and the command ls don't run so I've an error and the prompt change to oppvmi-ir1.sky.local(presidio) .
Now the command ls ca run correctly.

My system is a SunOS 5.8.

Thanks.