Threads, Client server model and wodssh - WeOnlyDo Discussion board

Threads, Client server model and wodssh (wodSSH / wodSSH.NET)

by Stelios, Monday, February 27, 2006, 08:09 (6844 days ago)

Greetings to all !
We are trying to develop and app using VB, where depending on which form you are viewing different requests are send to the remote host.
These requests consist of linux commands to retrieve varius info from the remote host at different time intervals
For example one type of request/command should be send once a second , others at different intervals.
Since bw is an issue we can not have multiple connections all running at the same time, but we need a way to seriaze them and execute them depending on (time) priority.

Our current model is using a 2 dimentional array to hold info on the command to be executed.
A timer event then parses the array and sends the commands using the non blocking mode of wodssh in background so that other tasks running in the foreground can procceed at the same time.
(The quotes in forground and background are intentional ;) )

The thing is we are having problems when trying to display info from the first command while the other is been executed in the background
or when we try to move the windows etc...
The app friezes or no more data are send to the host

To solve this one option is to use the win32 api and create a seperate thread, the other is to create a client/server model, where the server doing the ssh connections runs as a different task and communicates with our app through some signaling mechanism.

What i would like to know is if wodssh would work on a different thread as descussed in this
http://www.codeproject.com/threads/VBThread.asp

or we should go for a client/server solution ?


Re: Threads, Client server model and wodssh

by wodSupport, Monday, February 27, 2006, 14:14 (6844 days ago) @ Stelios

Stelios,

I should ask you, why does your app freeze in the first place? How often are you executing commands? Several times per second? And responses, are they tooooooo large? It's really wierd for it to freeze when we talk about SSH and unix commands which generally don't last too long.

Anyway.. I don't think creating new thread will solve your problems. Sure, you can have one in VB using few tricks, but you can't do anything with it except make it 'be on their own'. If such thread fires any event, VB will crash. You would have to use blocking mode with Sleep API calls etc.. I don't think this is convinient model.

As for client-server, this sounds as much more interesting. You can easily pass data back and forth using some sort of IPC mechanism, and service could handle it with ease.

But.. Who says that service will not block as well? What will make it so different than your current app?

Kreso

Re: Threads, Client server model and wodssh

by stelios, Monday, March 06, 2006, 13:19 (6837 days ago) @ wodSupport

Stelios,

I should ask you, why does your app freeze in the first place? How often are you executing commands? Several times per second? And responses, are they tooooooo large?

The fastest a command can execute is once every second (retrieve some traffic data for example)
Large transfers occur but are scheduled once every 60 seconds
(retrieve a 300 lines routing table for example -> route -n)

We get a steady 10kbit traffic peak for the every second requests which jumps to 100+ kbit when asking for large amount of data


But.. Who says that service will not block as well? What will make it so different than your current app?
Kreso

We are not sure at the moment where the problem is as we get erratic responces.
Either the VB timer seems not to generate events and thus not servicing the rest of the que or the entire app frezes .
We are trying to figure out if a particular command/code part causes the problem or its a VB/component problem.