Re: FTP Server Problem

Giganews Newsgroups
Subject: Re: FTP Server Problem
Posted by:  Remy Lebeau \(Indy Team\) (re…@lebeausoftware.org)
Date: Sat, 6 Aug 2011

"vez" <vlez…@gmail.com> wrote in message
news:5D454557EFE6E340vlez…@gmail.com...

> If somebody is connected to this server, it is not possible to set
> IdFTPServer.Active := False;

You should be able to.  Are you running any file transfers at the time?

> Prgram will not answer after that and I have to kill it.

That means one (or more) of the server's threads has become deadlocked.  Are
you deactivating the server from within the context of the main thread?  If
so, then are you performing any synchronized operations in the OnConnect or
OnDisconnect events using TIdSync or TThread::Synchronize()?  If so, then
that will deadlock, since the main thread is not able to process the sync
requests.  You would have to either not perform the sync operations during
deactivation, switch to using TIdNotify, or do the deactivation in a
different thread.

> how to get from the IdFTPServer number on connected clients?

The TIdFTPServer.Contexts property is a TThreadList that holds the running
client thread objects.  You can lock the list and read its Count property.

--
Remy Lebeau (TeamB)

Replies

None

In response to

FTP Server Problem posted by vez on Thu, 4 Aug 2011