|Subject:||Re: IdFTPServer don`t work correct?|
|Posted by:||Remy Lebeau (TeamB) (email@example.com)|
|Date:||Thu, 3 Mar 2005|
"Dimm" <Di…@aport.ru> wrote in message
> TList *FTPThreadList = FTPServer->Threads->LockList();
You should not be unocking the list yet. You need to keep it locked while
you are accessing the threads.
> if(lstrcmpi("10.1.1.1", ((TIdPeerThread
Use the following instead:
> // This strings terminate with window Access Violation
There are several problems with that code:
1) you did not keep the TThreadList locked. When you disconnect the socket,
its thread disappears from the server's Threads list and is freed, so you
are most likely accessing invalid pointers. That would account for the AV.
2) you are disconnecting the wrong socket to begin with. FTP uses multiple
connections per client - one connection for exchanging commands/responses,
and separate connections for the actual data transfers. You are
disconnecting the socket used for exchanging commands/responses, not socket
used for data transfers. Data transfers do not appear in the Threads list
at all. You need to cast the TIdPeerThread pointer to a TIdFTPServerThread
and then call the TIdFTPServerThread::KillDataChannel() method.
3) you are trying to write data to the socket you just disconnected. Even
then, you are not writing valid FTP response data anyway. At the very
least, you did not include a CRLF at the end of the string.
> How i answer to the FTP client about that what the specified file or
folder does not exist?
Simply throw an exception in the appropriate event handler (OnGetFile,
OnStoreFile, OnChangeDirectory). TIdFTPServer sends back the Exception's
message in a properly-formatted FTP response.
> > > 5. Why the component hangs at copying a plenty of files and folders?
> > Again, you need to provide much more details.
> It is shown at copying a many files and folder from/to server.What you can
I do not understand what you are asking for.
IdFTPServer don`t work correct? posted by Dimm on Thu, 3 Mar 2005