Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Oct : Re: TIdTCPServer not shutting down
| Subject: | Re: TIdTCPServer not shutting down |
| Posted by: | "Roberto Meneghini" (rmeneghi..@separationsystems.com) |
| Date: | Thu, 5 Oct 2006 08:59:15 |
I think I've found the problem. I'm using a class derived from TThread to
log events in a TListView. The class is executed in the OnConnect,
OnDisconnect and OnExecute events. What I think is happening is that when
the server shuts down while a client is still connected, it issues a
OnDisconnect. At this point my log thread is created and it tries to updated
the TListView using the Synchronize method. However, at this point the form
is being destroyed and the thread never terminates. Does this sound logical?
Thanks,
Roberto
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:45243620$1@newsgroups.borland.com...
>
> "Roberto Meneghini" <rmeneghini@separationsystems.com> wrote in message
> news:45241979@newsgroups.borland.com...
>
>> I'm writing a Client/Server application using INDY10 for Delphi.NET.
>> I've noticed (using the Task Manager) that if I close the server
>> application while a client is still connected, the server process stays
> loaded.
>
> Without seeing your actual code, my guess is that you ar deadlocking the
> server's threads. When deactivating the server, it waits for the client
> threads to terminate. If the threads are doing something that interacts
> with the thread that is shutting down the server, a deadlock occurs.
>
>> However, this does not happen if the client(s) disconnect before
>> closing the server.
>
> Because the client threads are already gone by the time the server goes to
> wait on them, so it has nothing to wait on and can exit immediately.
>
>> My guess is that a thread is still active. Is there a way to force the
>> server to shutdown all the active connections.
>
> The server already does exactly that before then waiting on the threads to
> terminate. But disconnecting the connections is useless of the threads
> are
> deadlocked.
>
>
> Gambit