Jan Lund
2008-06-24 05:41:54 UTC
Hello.
I'm having a problem using TidSync (D2007 Indy 10).
I use TidCmdTCPServer to receive an incoming TIdcommand (chMessageCommmad as
descibed below) from one of 8 clients.
This creates my TidSync Descendant (TSyncLogParameter) which in turn was
supposed to update a VarPanel.
TVarPanels a list of Tpanels each with a TStringgrid. Which panel to update
is being decided by TVarPanels depending of the ParamOrigin.
Now i'd expect the following sequence to happen :
TSyncLogParameter.Create
TSyncLogParameter.Synchonize
TSyncLogParameter.DoSynchronize // Update the VarPanels stringgrids
TSyncLogParameter.Free;
But what happens is that my app. freezes.
When doing a trace, i can follow it from the TSyncLogParameter.Synchronize
down to TIdNotifyThread.Run where a FEvent.WaitForEver is executed.
And i must say that this part works perfectly ;o) - it really does wait
forever....
What am i doing wrong ?
Can someone point me in the right direction ?
Best regards
Jan
procedure TJLLabPcTCP.chMessageCommand(ASender: TIdCommand);
var
x: Integer;
st : String;
VVal: String;
VName: string;
begin
if ASender.Params[3]='Param' then
Begin // This is a parameter
VName:=ASender.Params[4];
For x:=5 to ASender.Params.Count-1 Do
VVal:=VVal+' '+ASender.Params[x];
VVal:=Trim(VVal);
TSyncLogParameter.WriteParam(VarPanels,ASender.Params[2],Vname,VVal);
// Create the TidSync Descendant
End
Else
....(it is not a parameter)
end;
TSyncLogParameter = Class(TidSync)
private
FParamName : String;
FParamValue : String;
FParamOrigin : String;
FVarPanels: TVarPanels;
{ private declarations }
protected
Procedure DoSynchronize; Override;
{ protected declarations }
public
Constructor Create(VarPanels : TVarPanels;const
AParamOrigin,AparamName,AParamValue : String);
class procedure WriteParam(VarPanels : TVarPanels;const
AParamOrigin,AparamName,AParamValue : String);
{ public declarations }
end;
{ TSyncLogParameter }
constructor TSyncLogParameter.Create(VarPanels: TVarPanels; const
AParamOrigin, AparamName, AParamValue: String);
begin
FVarPanels:=VarPanels;
FParamOrigin:=AParamOrigin;
FParamName:=AparamName;
FParamValue:=AParamValue;
inherited create;
end;
procedure TSyncLogParameter.DoSynchronize;
// This is the synchronized method. You can sefely write VCL stuff here.
begin
inherited;
if Assigned(FVarPanels) then
FVarPanels.WriteParam(FParamOrigin,FParamName,FParamValue);
end;
class procedure TSyncLogParameter.WriteParam(VarPanels : TVarPanels;const
AParamOrigin, AparamName, AParamValue : String);
begin
With Create(VarPanels,AParamOrigin,AparamName,AParamValue) Do
try
Synchronize;
finally
free;
end;
end;
I'm having a problem using TidSync (D2007 Indy 10).
I use TidCmdTCPServer to receive an incoming TIdcommand (chMessageCommmad as
descibed below) from one of 8 clients.
This creates my TidSync Descendant (TSyncLogParameter) which in turn was
supposed to update a VarPanel.
TVarPanels a list of Tpanels each with a TStringgrid. Which panel to update
is being decided by TVarPanels depending of the ParamOrigin.
Now i'd expect the following sequence to happen :
TSyncLogParameter.Create
TSyncLogParameter.Synchonize
TSyncLogParameter.DoSynchronize // Update the VarPanels stringgrids
TSyncLogParameter.Free;
But what happens is that my app. freezes.
When doing a trace, i can follow it from the TSyncLogParameter.Synchronize
down to TIdNotifyThread.Run where a FEvent.WaitForEver is executed.
And i must say that this part works perfectly ;o) - it really does wait
forever....
What am i doing wrong ?
Can someone point me in the right direction ?
Best regards
Jan
procedure TJLLabPcTCP.chMessageCommand(ASender: TIdCommand);
var
x: Integer;
st : String;
VVal: String;
VName: string;
begin
if ASender.Params[3]='Param' then
Begin // This is a parameter
VName:=ASender.Params[4];
For x:=5 to ASender.Params.Count-1 Do
VVal:=VVal+' '+ASender.Params[x];
VVal:=Trim(VVal);
TSyncLogParameter.WriteParam(VarPanels,ASender.Params[2],Vname,VVal);
// Create the TidSync Descendant
End
Else
....(it is not a parameter)
end;
TSyncLogParameter = Class(TidSync)
private
FParamName : String;
FParamValue : String;
FParamOrigin : String;
FVarPanels: TVarPanels;
{ private declarations }
protected
Procedure DoSynchronize; Override;
{ protected declarations }
public
Constructor Create(VarPanels : TVarPanels;const
AParamOrigin,AparamName,AParamValue : String);
class procedure WriteParam(VarPanels : TVarPanels;const
AParamOrigin,AparamName,AParamValue : String);
{ public declarations }
end;
{ TSyncLogParameter }
constructor TSyncLogParameter.Create(VarPanels: TVarPanels; const
AParamOrigin, AparamName, AParamValue: String);
begin
FVarPanels:=VarPanels;
FParamOrigin:=AParamOrigin;
FParamName:=AparamName;
FParamValue:=AParamValue;
inherited create;
end;
procedure TSyncLogParameter.DoSynchronize;
// This is the synchronized method. You can sefely write VCL stuff here.
begin
inherited;
if Assigned(FVarPanels) then
FVarPanels.WriteParam(FParamOrigin,FParamName,FParamValue);
end;
class procedure TSyncLogParameter.WriteParam(VarPanels : TVarPanels;const
AParamOrigin, AparamName, AParamValue : String);
begin
With Create(VarPanels,AParamOrigin,AparamName,AParamValue) Do
try
Synchronize;
finally
free;
end;
end;