Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Сети";
Текущий архив: 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
15-1149594374
Проходящий
2006-06-06 15:46
2006.07.23
Прорыв в математике: доказана еще одна теория


1-1149770827
harddrive_tester
2006-06-08 16:47
2006.07.23
Запуск программы с параметром и ожидание завершения


6-1142107910
Daimyo
2006-03-11 23:11
2006.07.23
кодировка и indy


9-1132234558
ПЛОВ
2005-11-17 16:35
2006.07.23
Вопрос по OpenGL


2-1151873123
Deny20
2006-07-03 00:45
2006.07.23
помогите чем могите разобраться с печатью Курсак горит!!!





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский