Форум: "Сети";
Текущий архив: 2006.07.23;
Скачать: [xml.tar.bz2];
ВнизМетод OnExecute в Indy10 Найти похожие ветки
← →
Derr (2006-03-17 11:12) [0]есть маленькая проблема.... при присоединении клиента к серверу вначале на стороне сервера вызывается OnConnect
после ентого OnExecute.... в этом методе я пытаюсь что то считать..
но когда я делаю сервер не активным... у меня происходит ошибка.... и сервак повисает... в Indy других версийй все было нормально... а тут ......
Код метода:
procedure TTCPServerClass._OnExecute(aThread: TIdContext);
var
aBuffer: TBytes;
aQ: RQuery;
aR: RReply;
begin
try
aThread.Connection.IOHandler.ReadBytes(aBuffer, SizeOf(aQ), False);
except
on E: Exception do
begin
MessageController.SendMessage(CONST_ARRAY_ERR[6,0] + CONST_ARRAY_ERR[6,1] + ": " + E.Message ,tmcErrMess);
Exit;
end;
end;
BytesToRaw(aBuffer, aQ, SizeOf(aQ));
case aQ.QueryType of
tqtSendToHost:
begin
end;
tqtNewFile:
begin
NewFile(AThread, aQ);
end;
else begin
end;
end;
end;
← →
Eraser © (2006-03-17 12:42) [1]
> Derr (17.03.06 11:12)
так и должно быть! см. исходники Indy
procedure TIdCustomTCPServer.TerminateAllThreads;
var
i: Integer;
begin
// TODO: reimplement support for TerminateWaitTimeout
//BGO: find out why TerminateAllThreads is sometimes called multiple times
//Kudzu: Its because of notifications. It calls shutdown when the Scheduler is
// set to nil and then again on destroy.
if Contexts <> nil then begin
with Contexts.LockList do try
for i := 0 to Count - 1 do begin
// Dont call disconnect with true. Otherwise it frees the IOHandler and the thread
// is still running which often causes AVs and other.
TIdContext(Items[i]).Connection.Disconnect(False);
end;
finally Contexts.UnLockList; end;
end;
// Scheduler may be nil during destroy which calls TerminateAllThreads
// This happens with explicit schedulers
if Scheduler <> nil then begin
Scheduler.TerminateAllYarns;
end;
end;
Страницы: 1 вся ветка
Форум: "Сети";
Текущий архив: 2006.07.23;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.011 c