Article View: borland.public.cppbuilder.internet.socket
Article #1312Re: BCB6 Pro, Indy 9, IdFTPServer LIST problems
From: Paul at NCF
Date: Wed, 21 Feb 2007 09:23
Date: Wed, 21 Feb 2007 09:23
151 lines
5510 bytes
5510 bytes
Hi,
> You are using DOS-style path delimiters, but TIdFTPServer defalts to
> Unix-style delimiters instead. That has a big influence on
> TIdFTPServer's behavior. You can't mix the two together.
But I'm setting the server emulate property to DOS, does that not mean the
server doesn't change to use '\' instead of '/'?
> If you are using Indy 10, then I suggest you attach a TIdFTPFileSystem
> instead of trying to parse everything yourself manually.
I'm using 9.0.50 I think, the last dev snapshot.
> Comparing the last character in the string to the specified path
> delimiter.
Yes, so in DOS emulation mode it is checking or using '\' delimiter
> TIdPeerThread.Connection.Socket.Binding.PeerIP
Knew it had to be somewhere!
> Since you did not show any of your code, there is no way to diagnose
> your problem.
I'm setting to DOS in design time. I'm using Windows XP FTP client to test
against. This is a prototype, not by any means a viable application, just
trying to get a feel for the component.
Maybe the FTP server is working ok and its just that APath doesn't look
right, but its ok. The client closes the connection after the DIR command.
What code needs to go in the dir event handler or (cd handler)?
//---------------------------------------------------------------------------
void __fastcall TMainForm::IdFTPServerConnect(TIdPeerThread *AThread)
{
AnsiString str = "Client Connected:";
DebugWindow->Lines->Add(str);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::IdFTPServerDisconnect(TIdPeerThread *AThread)
{
AnsiString str = "Client Disconnected:";
DebugWindow->Lines->Add(str);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::IdFTPServerUserLogin(
TIdFTPServerThread *ASender, const AnsiString AUsername,
const AnsiString APassword, bool &AAuthenticated)
{
bool result = false;
AnsiString str = "Client Login Requested:";
DebugWindow->Lines->Add(str);
// Verify User Name/Password
str = " " + AUsername + " " + APassword;
DebugWindow->Lines->Add(str);
if (AUsername == "ctsguest") result = true;
// Verify Remote Client
// logon result?
AAuthenticated = result;
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::IdFTPServerAfterUserLogin(
TIdFTPServerThread *ASender)
{
AnsiString str = "Client Logged On:";
DebugWindow->Lines->Add(str);
//
ASender->HomeDir = "C:\\";
str = " Home Dir:" + ASender->HomeDir;
DebugWindow->Lines->Add(str);
str = " Current Dir:" + ASender->CurrentDir;
DebugWindow->Lines->Add(str);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::IdFTPServerListDirectory(
TIdFTPServerThread *ASender, const AnsiString APath,
TIdFTPListItems *ADirectoryListing)
{
AnsiString str = "Client Requested Directory Listing:";
DebugWindow->Lines->Add(str);
//
str = " " + ASender->HomeDir;
DebugWindow->Lines->Add(str);
str = " " + ASender->CurrentDir;
DebugWindow->Lines->Add(str);
str = " " + APath;
DebugWindow->Lines->Add(str);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::IdFTPServerChangeDirectory(
TIdFTPServerThread *ASender, AnsiString &VDirectory)
{
AnsiString str = "Client Requested Change Directory:";
DebugWindow->Lines->Add(str);
//
str = " " + VDirectory;
DebugWindow->Lines->Add(str);
}
//---------------------------------------------------------------------------
Debug output window looks like this:
System Running....
Client Connected:
Client Login Requested:
ctsguest
Client Logged On:
Home Dir:C:\
Current Dir:/
Client Requested Change Directory: (typed "cd \temp" in client)
\temp
Client Requested Directory Listing: (typed "dir" in client)
C:\
\temp
\temp/
OR
Client Connected:
Client Login Requested:
ctsguest
Client Logged On:
Home Dir:C:\
Current Dir:/
Client Requested Change Directory: (typed "cd /temp" in client)
/\/temp
Client Requested Directory Listing: (typed "dir" in client)
C:\
/\/temp
/\/temp/\
Client Disconnected:
Thanks
Paul
Technical Details
Message-ID:
<45dc0f7a@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45d83fd9$1@newsgroups.borland.com> <45db41fd$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,4582a45f81472bd4 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Paul at NCF" <notplmacca@clara.co.uk> Newsgroups: borland.public.cppbuilder.internet.socket References: <45d83fd9$1@newsgroups.borland.com> <45db41fd$1@newsgroups.borland.com> Subject: Re: BCB6 Pro, Indy 9, IdFTPServer LIST problems Date: Wed, 21 Feb 2007 09:23:38 -0000 Lines: 153 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 86.142.235.94 Message-ID: <45dc0f7a@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1172049786 86.142.235.94 (21 Feb 2007 01:23:06 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail