socketconncetion+midas组的三层,开始时速度不慢.不知怎的,现在要这么久.
设断点发现,程序运行到socketcon.Connected := true;时,就是这里,要30秒才过.procedure Tsysdb.DataModuleCreate(Sender: TObject);
var INISVN:Tinifile;
begin
INISVN:=Tinifile.Create(CON_CNININAME);
with INISVN do
begin
PubV_address :=INISVN.ReadString(CON_INTMBLOCK,'远程服务器ip','');
if pubV_address='' then//新用户
begin
frm_remoteconfig:=Tfrm_remoteconfig.Create(application);
frm_remoteconfig.ShowModal;
frm_remoteconfig.Release;
end;
PubV_address :=INISVN.ReadString(CON_INTMBLOCK,'远程服务器ip','');
free;
end;
socketcon.Connected:=false;
socketcon.Address :=PubV_address;
socketcon.ServerName:='MnfAppserver.MnfFind';
TRY
socketcon.Connected := true;//就是这里,要等待30秒才过
Disp_MnfFind:=IMnfFindDisp(IDispatch(socketcon.AppServer));
EXCEPT
application.MessageBox(CON_REMOTCONEER,CON_PROMPT,MB_OK+MB_ICONINFORMATION);
halt(0);
END;
end;
设断点发现,程序运行到socketcon.Connected := true;时,就是这里,要30秒才过.procedure Tsysdb.DataModuleCreate(Sender: TObject);
var INISVN:Tinifile;
begin
INISVN:=Tinifile.Create(CON_CNININAME);
with INISVN do
begin
PubV_address :=INISVN.ReadString(CON_INTMBLOCK,'远程服务器ip','');
if pubV_address='' then//新用户
begin
frm_remoteconfig:=Tfrm_remoteconfig.Create(application);
frm_remoteconfig.ShowModal;
frm_remoteconfig.Release;
end;
PubV_address :=INISVN.ReadString(CON_INTMBLOCK,'远程服务器ip','');
free;
end;
socketcon.Connected:=false;
socketcon.Address :=PubV_address;
socketcon.ServerName:='MnfAppserver.MnfFind';
TRY
socketcon.Connected := true;//就是这里,要等待30秒才过
Disp_MnfFind:=IMnfFindDisp(IDispatch(socketcon.AppServer));
EXCEPT
application.MessageBox(CON_REMOTCONEER,CON_PROMPT,MB_OK+MB_ICONINFORMATION);
halt(0);
END;
end;
你的Remote Data Module是怎样构建的?
var
ConStr,CurComputer:string;
sysDName:string;
sysSName:string;
FileIni:TIniFile;
begin
CurComputer :=PriP_GetComputerName;
FileIni:=TIniFile.Create(CONFILE);
With FileIni do
begin
sysDName:=ReadString(DBLOCK,DBASENAME,'Stock');
sysSName:=ReadString(DBLOCK,SERVERNAME,CurComputer);
ConStr :=ReadString(DBLOCK,CONNECTSTR,'');
if not SectionExists(DBLOCK) then
begin
writestring(DBLOCK,DBASENAME,sysDName);
writestring(DBLOCK,SERVERNAME,sysSName);
end;
free;
End;
if Trim(ConStr)='' then
ConStr:=' Provider=SQLOLEDB.1;password=ibm20020706;Persist Security Info=False;User ID=sa;Initial '
+'Catalog='+sysDName+';Data Source='+sysSName
+';Connect Timeout=15;Use Procedure for Prepare=1;'
+'Auto Translate=True;Packet Size=4096';
Adocon.connected:=False;
Adocon.ConnectionString :=ConStr;
try
Adocon.Connected :=True;
except
application.MessageBox('数据库连接出错,请核查数据库是否正常运行!','提示信息',MB_OK+MB_ICONSTOP);
Halt(0);
end;
end;
try
Adocon.Connected :=True;
except
on e:exception do
begin
raise exception.create('数据库连接出错,请核查数据库是否正常运行!'+#13+e.message);
end;
end;