IdTCPServer1.Active:= false;关闭服务的时候,
总是提示"Termainate Thread Timeout"错误.
IdTCPServer1.TerminateWaitTime 已经设置很大了.但还是出现超时问题.
我在程序中使用了以下程序代码,我想可能是这个的原因造成.
还请各位大侠帮我解决一下.在线等待佳音!!!!!!!!!!!!
try
list:= IdTCPServer1.Threads.LockList;
finally
IdTCPServer1.Threads.UnlockList;.//解锁
end;
总是提示"Termainate Thread Timeout"错误.
IdTCPServer1.TerminateWaitTime 已经设置很大了.但还是出现超时问题.
我在程序中使用了以下程序代码,我想可能是这个的原因造成.
还请各位大侠帮我解决一下.在线等待佳音!!!!!!!!!!!!
try
list:= IdTCPServer1.Threads.LockList;
finally
IdTCPServer1.Threads.UnlockList;.//解锁
end;
解决方案 »
- 高分求,Pos小票打印图片!急!
- 如何判断cxGridDBBandedTableView 点击的是第几列
- 关于ado多线程的问题,请大家帮忙看看
- 请问各位大侠,国外有没有类似DFW或者CSDN这样的比较好的论坛??
- 请各位讨论一下,现在用什么技术做三层?
- 娘娘的,QQ真强,哎,对它没辙了~~~心情不愉快,送份100
- 我把函数名存在一个字符串里,怎样动态地去执行它.
- 用QReport怎么做出像Word中的表格来?
- 怎样在QuickReport Preview时的“打印”按钮按下时,根据某个值判断是否能打印。写在哪个事件中呢?谢谢
- 如何把计算机和电视机连起来玩游戏
- 如何将edit中的数据显示再messagedlg和showmessage中?
- 郁闷至极,问一个及其简单的问题
版本9.0.14
修正IdTCPServer.pas的
procedure TIdTCPServer.SetActive(AValue: Boolean);
var
i: Integer;
LListenerThread: TIdListenerThread;
begin
// SG 28/11/01: removed the "try..finally FActive := AValue; end;" wrapper
// SG 28/11/01: It cause the component to be locked in the "active" state, even if
// SG 28/11/01: the socket couldn't be bound.
if (not (csDesigning in ComponentState)) and (FActive <> AValue)
and (not (csLoading in ComponentState)) then begin
if AValue then begin
// InitializeCommandHandlers must be called only at runtime, and only after streaming
// has occured. This used to be in .Loaded and that worked for forms. It failed
// for dynamically created instances and also for descendant classes.
if not FCommandHandlersInitialized then begin
FCommandHandlersInitialized := True;
InitializeCommandHandlers;
end;
// Set up bindings
if Bindings.Count = 0 then begin
Bindings.Add;
end; // Set up ThreadMgr
ThreadMgr.ThreadClass := ThreadClass; // Setup IOHandler if not Assigned(FIOHandler) then begin
IOHandler := TIdServerIOHandlerSocket.Create(self);
FImplicitIOHandler := true;
end;
// Update reply texts for "global" replies
ReplyTexts.UpdateText(ReplyUnknownCommand);
ReplyTexts.UpdateText(MaxConnectionReply);
// Set up listener threads IOHandler.Init;
i := 0;
try
while i < Bindings.Count do begin
with Bindings[i] do begin
AllocateSocket;
if (FReuseSocket = rsTrue) or ((FReuseSocket = rsOSDependent) and (GOSType = otLinux))
then begin
SetSockOpt(Id_SOL_SOCKET, Id_SO_REUSEADDR, PChar(@Id_SO_True), SizeOf(Id_SO_True));
end;
Bind;
end;
Inc(i);
end;
except
Dec(i); // the one that failed doesn't need to be closed
while i >= 0 do begin
Bindings[i].CloseSocket;
Dec(i);
end;
FActive := True;
SetActive(False); // allow descendants to clean up
raise;
end;
FListenerThreads := TThreadList.Create;
for i := 0 to Bindings.Count - 1 do begin
Bindings[i].Listen(FListenQueue);
LListenerThread := TIdListenerThread.Create(Self, Bindings[i]);
FListenerThreads.Add(LListenerThread);
LListenerThread.Start;
end;
FActive := True; // fixed by Liu Yang 2007.7.24 end else begin
TerminateListenerThreads;
FActive := false; // fixed by Liu Yang 2007.7.24
// Tear down ThreadMgr
try
TerminateAllThreads;
finally
if ImplicitThreadMgr and TIdThreadSafeList(Threads).IsCountLessThan(1) then begin // DONE -oAPR: BUG! Threads still live, Mgr dead ;-(
FreeAndNil(FThreadMgr);
FImplicitThreadMgr := False;
end;
end;//tryf
end;
end;
end;重新编译Indy可解决问题!
我试过了,还是不行啊?可以留下你的联系方式吗?谢谢!!!!!11