Board index » delphi » AV with TIdTCPServer.Active := False ?
Steve
![]() Delphi Developer |
Wed, 18 Feb 2004 06:06:58 GMT
|
Steve
![]() Delphi Developer |
Wed, 18 Feb 2004 06:06:58 GMT
AV with TIdTCPServer.Active := False ?
When ever I try to close clients with Active := False or
Connection.DisconnectSocket/Disconnect; I get a AV. The IDE directs me to this line of code ---> IdSocketHandel.pas function TIdSocketHandle.Recv(var ABuf; ALen, AFlags: Integer): Integer; If the client closes the connection the normal exception is raized. anyone have any ideas? This only started with Indy v9.0 Cheers |
Doychin Bondzhev - Team Ind
![]() Delphi Developer |
Wed, 18 Feb 2004 14:16:48 GMT
Re:AV with TIdTCPServer.Active := False ?In case you call Active := false when you have active connection whcih reads something at the same time this is normal. This is happening becouse the DisconnectSocket frees the Binding and Handle is not valid any more. The exception is catched in the server code and is used to inform the rest of the thread code that the connection has been closed. Doychin Bondzhev - Team Indy Quote"Steve" <s...@icon.co.za> wrote in message news:3b900aca_1@dnews... |
Stev
![]() Delphi Developer |
Wed, 18 Feb 2004 16:56:01 GMT
Re:AV with TIdTCPServer.Active := False ?"Doychin Bondzhev - Team Indy" <doyc...@dsoft-bg.com> wrote in message news:3b907cf3_2@dnews... Quote> In case you call Active := false when you have active connection whcih I also said that when I do a Cheers Steve |
Charles Stac
![]() Delphi Developer |
Wed, 18 Feb 2004 22:27:02 GMT
Re:AV with TIdTCPServer.Active := False ?Raising a planned AV is not a good thing, in my opinion, as you never know if it will be handled correctly or not. As you known, an unhandled AV in a thread will cause all sorts of bad things (usually by terminating your app or worse). I suspect this may be the root cause of the thread timeout errors we mentioned before when shutting down a server that has active clients. Would it not make more sense to do the following when setting active := 1) Prevent the listener socket from accepting any more connections. Charles "Doychin Bondzhev - Team Indy" <doyc...@dsoft-bg.com> wrote in message Quote> In case you call Active := false when you have active connection whcih |
Doychin Bondzhev - Team Ind
![]() Delphi Developer |
Wed, 18 Feb 2004 23:11:03 GMT
Re:AV with TIdTCPServer.Active := False ?Quote> 1) Prevent the listener socket from accepting any more connections. connections which has to be closed and if they are doing something with sockets the only way to top them is to close all sockets. Closing all sockes couses all these AV's which are handlend in the Execute method of TIdPeeThread and then all threads are terminated. The reason of timeout problems is mostly bad written OnExecute code. Quote> 2) Shutdown active connections gracefully. operation and the only way is DisconnectSocket. Becouse it frees the Binding property this couse the AV' sibn Recv or Send methods. I can only advice you to update your indy sources and try with all new Doychin Bondzhev - Team Indy |
Charles Stac
![]() Delphi Developer |
Wed, 18 Feb 2004 23:24:42 GMT
Re:AV with TIdTCPServer.Active := False ?Hmmm. From what you've written the problem is that if you have an AV in the kernel or in Winsock itself, you may not be able to catch it and recover gracefully. There is no reason that you can't stop accepting connections on a listening I will try the latest revisions to see if they make a difference. Charles "Doychin Bondzhev - Team Indy" <doyc...@dsoft-bg.com> wrote in message Quote> > 1) Prevent the listener socket from accepting any more connections. |
Doychin Bondzhev - Team Ind
![]() Delphi Developer |
Wed, 18 Feb 2004 23:29:05 GMT
Re:AV with TIdTCPServer.Active := False ?Exceptions does not accoure in the Kernelo or winsock. They occure becouse of freeing the TIdIOHandlerSocket.Binding property. Quote"Charles Stack" <char...@codycomp.com> wrote in message Quote> Hmmm. From what you've written the problem is that if you have an AV in |
Charles Stac
![]() Delphi Developer |
Thu, 19 Feb 2004 00:36:06 GMT
Re:AV with TIdTCPServer.Active := False ?Ah...but the developer doesn't have explicit control over this. Referencing a component that has been freed is something that should be remedied. No? Charles "Doychin Bondzhev - Team Indy" <doyc...@dsoft-bg.com> wrote in message Quote> Exceptions does not accoure in the Kernelo or winsock. They occure becouse |
Hadi Hariri - Team In
![]() Delphi Developer |
Thu, 19 Feb 2004 05:13:33 GMT
Re:AV with TIdTCPServer.Active := False ?Quote>sockes couses all these AV's which are handlend in the Execute method of |
Hadi Hariri - Team In
![]() Delphi Developer |
Thu, 19 Feb 2004 05:14:38 GMT
Re:AV with TIdTCPServer.Active := False ?Quote>Exceptions does not accoure in the Kernelo or winsock. They occure the problem. |
Doychin Bondzhev - Team Ind
![]() Delphi Developer |
Thu, 19 Feb 2004 06:11:07 GMT
Re:AV with TIdTCPServer.Active := False ?I fixed the problem and it has to be OK now. Quote"Charles Stack" <char...@codycomp.com> wrote in message Quote> Ah...but the developer doesn't have explicit control over this. |
Charles Stac
![]() Delphi Developer |
Thu, 19 Feb 2004 10:17:53 GMT
Re:AV with TIdTCPServer.Active := False ?Thank you. <g> "Hadi Hariri - Team Indy" <hadi...@pbe.com> wrote in message Quote> >sockes couses all these AV's which are handlend in the Execute method of |
1. TidTCPServer Active := false exception
2. TidTCPServer.Active := false (closing connections)
3. Indy: IdTCPServer.Active := False causes AV
4. IsServiceRunning must return False when Active=False
5. newbie : replace active := false active := true
6. TIdTCPServer AV - Possible cause...
8. Subject: AV IBX 6.04 and FixedChar = False