Anyway around this?
Anyway around this?
I have been using SecureBridge for a while now, and one thing that irritates me is when something is happening, say I am running this line of code:
Result:=ScSSHShell.ExecuteCommand(sCommand);
and it take a few seconds for a result to come back, the application just freezes while it waits.
You might at this point suggest using nonblocking mode, and yes that a good idea, however, its not just this area that causes the app. to freeze.
When you connect and for whatever reason the server is not availible bease of a wrong IP or its just off line, then this also freezes the application.
Is there a work-around for this? I have tried a few things, but maybe the controls are just not threaded which is the issue.
I am keen to know, as it actually causes a few issues for use.
Thanks, Jeremy
Result:=ScSSHShell.ExecuteCommand(sCommand);
and it take a few seconds for a result to come back, the application just freezes while it waits.
You might at this point suggest using nonblocking mode, and yes that a good idea, however, its not just this area that causes the app. to freeze.
When you connect and for whatever reason the server is not availible bease of a wrong IP or its just off line, then this also freezes the application.
Is there a work-around for this? I have tried a few things, but maybe the controls are just not threaded which is the issue.
I am keen to know, as it actually causes a few issues for use.
Thanks, Jeremy
Re: Anyway around this?
To solve the problem you can use the NonBlocking mode by setting the ScSSHShell.NonBlocking property to True. You can find more detailed information about it in the SecireBridge help.jscoulter wrote:I have been using SecureBridge for a while now, and one thing that irritates me is when something is happening, say I am running this line of code:
Result:=ScSSHShell.ExecuteCommand(sCommand);
and it take a few seconds for a result to come back, the application just freezes while it waits.
Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next SecireBridge build.jscoulter wrote:When you connect and for whatever reason the server is not availible bease of a wrong IP or its just off line, then this also freezes the application.
I did say in my origial post "You might at this point suggest using nonblocking mode" and hey, you did ! So I thought that might actually show that I am AWARE of a solution.
Is there though nothing you can do in the code "like" application.processmessages so that even when nonblocking mode is false and your code is waiting for a response that it doesnt tie up the process?
The problem with nonblocking mode of course you sometimes get other data you dont need and you have to filter it where as in blocking mode you are getting the data from the command you are executing.
when you say "Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next SecireBridge build." is this the release same you mention in another post back on September the 1st in the following message http://www.devart.com/forums/viewtopic.php?t=15698
Is there a time frame for the release.
Jeremy
Is there though nothing you can do in the code "like" application.processmessages so that even when nonblocking mode is false and your code is waiting for a response that it doesnt tie up the process?
The problem with nonblocking mode of course you sometimes get other data you dont need and you have to filter it where as in blocking mode you are getting the data from the command you are executing.
when you say "Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next SecireBridge build." is this the release same you mention in another post back on September the 1st in the following message http://www.devart.com/forums/viewtopic.php?t=15698
Is there a time frame for the release.
Jeremy
We can't use the Application.ProcessMessages method because this component can be used in service application, that doesn't allow using this way.jscoulter wrote:Is there though nothing you can do in the code "like" application.processmessages so that even when nonblocking mode is false and your code is waiting for a response that it doesnt tie up the process?
Yes, I meant this build. The SecureBridge build where the problem is solved will be released by the end of this week.jscoulter wrote:when you say "Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next SecireBridge build." is this the release same you mention in another post back on September the 1st in the following message http://www.devart.com/forums/viewtopic.php?t=15698
Is there a time frame for the release.
fair enough.
Heres a wee tip. Maybe this will help.
Like you said Aplication.processmessages is not availible in a service, so whenI write a service I use the following:-
procedure TJeremysService.ProcessMessages;
var
Msg: TMsg;
begin
if PeekMessage(Msg, 0, 0, 0, PM_REMOVE) then
begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end;
Instead of application.processmessages, I just call my function "ProcessMessages;" which works well.
Maybe its worth trying?
Jeremy
Heres a wee tip. Maybe this will help.
Like you said Aplication.processmessages is not availible in a service, so whenI write a service I use the following:-
procedure TJeremysService.ProcessMessages;
var
Msg: TMsg;
begin
if PeekMessage(Msg, 0, 0, 0, PM_REMOVE) then
begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end;
Instead of application.processmessages, I just call my function "ProcessMessages;" which works well.
Maybe its worth trying?
Jeremy
We can't support such functionality, because that solution can cause different problems in service application. Using not NonBlocking mode assumes that the method will not return control until a command is not executed.
In order to solve the problem you can call the ExecuteCommand method in another thread.
Please, describe in more details why you don't use the NonBlocking mode.
In order to solve the problem you can call the ExecuteCommand method in another thread.
Please, describe in more details why you don't use the NonBlocking mode.
maybe you could explain WHAT issue this causes in service applications? This function is designed to work IN service applications and I use it in many servie applications with no issues at all.
To call the execute method in thread makes no difference, I have tired.
The reason I dont use non blocking mode is simple. If I execute a command I get the result back in the same function its called from.
I Then dont have to add process overhead by calling repeat/until waiting for a reply in another event.
ITs far easier to work when executing scripts one after another.
Jeremy
To call the execute method in thread makes no difference, I have tired.
The reason I dont use non blocking mode is simple. If I execute a command I get the result back in the same function its called from.
I Then dont have to add process overhead by calling repeat/until waiting for a reply in another event.
ITs far easier to work when executing scripts one after another.
Jeremy
I did not fully understnad what you mean?jscoulter wrote:also, another reason for nonblocking being false, I just remembered that there are infact commands I run the server that have NO output....as I just found now doing some testing. That is out of my control, so that is another reason
Note: Depending whether the NonBlocking property is True or False, commands on SSH server are executed in different ways. Please check that you get the same result when you use both ways.
Ok I will make it clearer.
I can call a command on the server, and it gernerates NO RESULT i.e. there is no output from calling the command on the server.
So, OnAsyncReceive is not fired because there is nothing returned.
Trust me I have just been testing this !
So, if nonblocking is set to false, when the command has executed, it completes even though nothing is returned. The fact that nothing is returned may be a positive result, i.e. the command executed correctly because a result might onkly be returned on an error executing the commmand.
IF I set nonblocking to true then go writestring('mycommand') which has no result from running like so:
***************************************************
repeat
application.processmessage
until sResponse ''
procedure ScSSHShell1AsyncReceive(Sender: TObject);
begin
sResponse:=ScSSHShell.ReadString;
end;
***************************************************
th app just just sits there because there is nothing returned.
However, if I do Result:=ScSSHShell.ExecuteCommand('mycommand'); with nonblocking to false its maks no difference if there is data in he result or not....the command was executed.
Does that make it a bit clearer??
Jeremy
I can call a command on the server, and it gernerates NO RESULT i.e. there is no output from calling the command on the server.
So, OnAsyncReceive is not fired because there is nothing returned.
Trust me I have just been testing this !
So, if nonblocking is set to false, when the command has executed, it completes even though nothing is returned. The fact that nothing is returned may be a positive result, i.e. the command executed correctly because a result might onkly be returned on an error executing the commmand.
IF I set nonblocking to true then go writestring('mycommand') which has no result from running like so:
***************************************************
repeat
application.processmessage
until sResponse ''
procedure ScSSHShell1AsyncReceive(Sender: TObject);
begin
sResponse:=ScSSHShell.ReadString;
end;
***************************************************
th app just just sits there because there is nothing returned.
However, if I do Result:=ScSSHShell.ExecuteCommand('mycommand'); with nonblocking to false its maks no difference if there is data in he result or not....the command was executed.
Does that make it a bit clearer??

Jeremy
well, maybe I wll jut have to upgrade to source code version and fix it myself hehehe 
Threads dont really solve the problem very well which is why I stated this whole thing off.
However, I have had a thought that MIGHT help solve part of my problem for commands that have no reply.
Is the new release going tbe made this weekend?
Jeremy

Threads dont really solve the problem very well which is why I stated this whole thing off.
However, I have had a thought that MIGHT help solve part of my problem for commands that have no reply.
Is the new release going tbe made this weekend?
Jeremy