W
wirerjf
Unregistered / Unconfirmed
GUEST, unregistred user!
我有段程序使用socketconnection连接进行数据处理的(代码如下),可能是由于
网络不稳定,如果数据处理操作的时间比较长(比如打印一个报表,rave.print),
在断开socketconntion连接时(这是我分析的)主程序有时就会无响应(只是有时,
跟踪抓不到现象),不知可有高手赐教,200分不够还可以再加。
var
theSocketConnection : TSocketConnection;
theFindClientData : TClientDataSet;
begin
theSocketConnection := TSocketConnection.Create(nil);
theFindClientData := TClientDataSet.Create(nil);
try
with theSocketConnectdo
begin
theSocketConnect.ServerGUID := '{XXXX-XXXX-XXXXXXXXXXX}';
theSocketConnect.Host := hostname;
theSocketConnect.Port := portnumber;
end;
with theFindClientDatado
begin
theClientDataSet.RemoteServer := theSocketConnect;
theClientDataSet.ProviderName := 'XXXXXXProvider';
end;
with theFindClientDatado
begin
active:=false;
commandtext:='';
try
commandtext:='select * from emp_inf';
active:=true;
//////////////////////////////////////
数据处理操作
///////////////////////////////////////
except
active:=false;
commandtext:='';
end;
end;
finally
theFindClientData.Active := false;
theFindClientData.commandtext := '';
theFindClientData.Close;
theFindClientData.Free;
if theSocketConnection.Connected then
theSocketConnection.Connected:=false;
theSocketConnection.Free;
end;
end;
网络不稳定,如果数据处理操作的时间比较长(比如打印一个报表,rave.print),
在断开socketconntion连接时(这是我分析的)主程序有时就会无响应(只是有时,
跟踪抓不到现象),不知可有高手赐教,200分不够还可以再加。
var
theSocketConnection : TSocketConnection;
theFindClientData : TClientDataSet;
begin
theSocketConnection := TSocketConnection.Create(nil);
theFindClientData := TClientDataSet.Create(nil);
try
with theSocketConnectdo
begin
theSocketConnect.ServerGUID := '{XXXX-XXXX-XXXXXXXXXXX}';
theSocketConnect.Host := hostname;
theSocketConnect.Port := portnumber;
end;
with theFindClientDatado
begin
theClientDataSet.RemoteServer := theSocketConnect;
theClientDataSet.ProviderName := 'XXXXXXProvider';
end;
with theFindClientDatado
begin
active:=false;
commandtext:='';
try
commandtext:='select * from emp_inf';
active:=true;
//////////////////////////////////////
数据处理操作
///////////////////////////////////////
except
active:=false;
commandtext:='';
end;
end;
finally
theFindClientData.Active := false;
theFindClientData.commandtext := '';
theFindClientData.Close;
theFindClientData.Free;
if theSocketConnection.Connected then
theSocketConnection.Connected:=false;
theSocketConnection.Free;
end;
end;