简体   繁体   中英

TApplicationEvents with TIdTcpServer Problem?

I would like to know if the TApplicationEvents component might cause some problem in case of an exception in the TcpServer OnExecute event, in this case preventing the indy from handling the error correctly.

i mean if use procedure TForm1.ApplicationEvents1Exception(Sender: TObject; E: Exception); event

can it generate problems on TIdTcpServer exceptions?

The TApplication(Events).OnException event is (normally) triggered only for unhandled exceptions that are raised in the context of the main UI thread. Worker threads do not (usually) trigger the TApplication(Events).OnException event. A thread would have to manually call TApplication.HandleException() for that to happen. Most threads, including Indy's, do not do that.

TIdTCPServer is a multi-threaded component. Its own events, including its On(Listen)Exception events, are triggered in the context of internal worker threads, not in the context of the main UI thread.

So, to answer your question, TApplication(Events) will not interfere with TIdTCPServer 's ability to handle is own exceptions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM