Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.07.23;
Скачать: CL | DM;

Вниз

Метод 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;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.03 c
1-1149937656
V.exeR
2006-06-10 15:07
2006.07.23
gen - плагин WinAMP a с формой


2-1151861380
Gloomer
2006-07-02 21:29
2006.07.23
Отображение PNG


15-1151141212
Fran
2006-06-24 13:26
2006.07.23
Защита ноутбука


2-1152003458
koha
2006-07-04 12:57
2006.07.23
Как остановить запущенный процесс


5-1135776058
Змей
2005-12-28 16:20
2006.07.23
установка компоненты