Thread View: borland.public.cppbuilder.internet.socket
13 messages
13 total messages
Started by Brian
Tue, 17 Aug 2004 21:31
Indy ftp server with c++ HELP PLEASE
Author: Brian
Date: Tue, 17 Aug 2004 21:31
Date: Tue, 17 Aug 2004 21:31
4 lines
1218 bytes
1218 bytes
I have been struggling with Indys ftpserver control for some time now. The examples given and the ones on the web are all in Delphi which doesnt really help all that much. I am looking for an example of one using builder c++ . If you have one or know of one, please let me know. If yuo don't have that , perhaps esomeone can give me an example of OnDirectoryList in c++ ? Thank you very much.
Re: Indy ftp server with c++ HELP PLEASE
Author: Remy Lebeau (TeamB)
Date: Tue, 17 Aug 2004 21:50
Date: Tue, 17 Aug 2004 21:50
16 lines
1276 bytes
1276 bytes
"Brian" <brianb@p3mc.net> wrote in message news:4122792e$1@newsgroups.borland.com... > The examples given and the ones on the web are > all in Delphi which doesnt really help all that much. Sure it does, because the concepts are the same in C++. > If yuo don't have that , perhaps esomeone can give > me an example of OnDirectoryList in c++ ? http://tinyurl.com/4mp32 Gambit
Re: Indy ftp server with c++ HELP PLEASE
Author: Brian
Date: Tue, 17 Aug 2004 22:00
Date: Tue, 17 Aug 2004 22:00
25 lines
1655 bytes
1655 bytes
Sorry for the butchered typing in the last post. Laptop keyboard :) Are there any other code examlpes you know of for c++? I would reallyu appreciate any more links you can provide. I think i will post my complete server in c++ when its doen to help others :) Thanks Gambit "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote: > >"Brian" <brianb@p3mc.net> wrote in message >news:4122792e$1@newsgroups.borland.com... > >> The examples given and the ones on the web are >> all in Delphi which doesnt really help all that much. > >Sure it does, because the concepts are the same in C++. > >> If yuo don't have that , perhaps esomeone can give >> me an example of OnDirectoryList in c++ ? > >http://tinyurl.com/4mp32 > > >Gambit > >
Re: Indy ftp server with c++ HELP PLEASE
Author: Brian
Date: Tue, 17 Aug 2004 22:07
Date: Tue, 17 Aug 2004 22:07
42 lines
2125 bytes
2125 bytes
I tried the code in the link. It gets an empty list when i login. Why is that? this is my code for OnAfterLogin
void __fastcall TfrmMain::IdFTPServer1AfterUserLogin(
TIdFTPServerThread *ASender)
{
// ASender is an autocreated thread for us
// Instance of struct
TFtpClient* AClient;
AClient = new TFtpClient;
ASender->HomeDir = '/';
ASender->CurrentDir = '/';
// Our struct for various settings
AClient->Thread = ASender;
AClient->IP = ASender->Connection->Socket->Binding->PeerIP.c_str() ;
AClient->RootPath = "c:\\" ; // Need function to return
// Pass this struct to our ASender thread
ASender->Data = AClient;
}
"Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote:
>
>"Brian" <brianb@p3mc.net> wrote in message
>news:4122792e$1@newsgroups.borland.com...
>
>> The examples given and the ones on the web are
>> all in Delphi which doesnt really help all that much.
>
>Sure it does, because the concepts are the same in C++.
>
>> If yuo don't have that , perhaps esomeone can give
>> me an example of OnDirectoryList in c++ ?
>
>http://tinyurl.com/4mp32
>
>
>Gambit
>
>
Re: Indy ftp server with c++ HELP PLEASE
Author: Remy Lebeau (TeamB)
Date: Tue, 17 Aug 2004 22:39
Date: Tue, 17 Aug 2004 22:39
10 lines
1161 bytes
1161 bytes
"Brian" <brianb@p3mc.net> wrote in message news:412281ad@newsgroups.borland.com... > I tried the code in the link. It gets an empty list when i login. Please show your listing code as well. Gambit
Re: Indy ftp server with c++ HELP PLEASE
Author: Brian
Date: Tue, 17 Aug 2004 22:54
Date: Tue, 17 Aug 2004 22:54
108 lines
4023 bytes
4023 bytes
Thank you gambit, here are my events so far:
void __fastcall TfrmMain::IdFTPServer1RetrieveFile(
TIdFTPServerThread *ASender, const AnsiString AFileName,
TStream *&VStream)
{
VStream = NULL;
try
{
VStream = new TFileStream(AFileName, fmOpenRead |
fmShareDenyWrite);
}
catch(Exception&)
{
// an error occured opening the file for reading
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::IdFTPServer1StoreFile(
TIdFTPServerThread *ASender, const AnsiString AFileName,
bool AAppend, TStream *&VStream)
{
VStream = NULL;
WORD mode = fmCreate;
if(AAppend)
mode = (fmOpenReadWrite | fmShareDenyWrite);
try
{
VStream = new TFileStream(AFileName, mode);
}
catch(Exception&)
{
// an error occured opening the file for writing
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::IdFTPServer1AfterUserLogin(
TIdFTPServerThread *ASender)
{
// ASender is an autocreated thread for us
// Instance of struct for settings
TFtpClient* AClient;
AClient = new TFtpClient;
ASender->HomeDir = '/';
ASender->CurrentDir = '/';
// Our struct for various settings
AClient->Thread = ASender;
AClient->IP = ASender->Connection->Socket->Binding->PeerIP.c_str() ;
AClient->RootPath = "c:\\" ; // Need function to return
// Pass this struct to our ASender thread
ASender->Data = AClient;
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::IdFTPServer1ListDirectory(
TIdFTPServerThread *ASender, const AnsiString APath,
TIdFTPListItems *ADirectoryListing)
{
TSearchRec sr;
if( FindFirst(APath + "*.*", faAnyFile, sr) == 0 )
{
do
{
//if( sr.Name == "." || sr.Name = ".." )
// continue;
TIdFTPListItem *Item = ADirectoryListing->Add();
if( sr.Attr & faDirectory )
Item->ItemType = ditDirectory;
else
Item->ItemType = ditFile;
Item->FileName = sr.Name;
Item->Size = sr.Size;
Item->ModifiedDate = FileDateToDateTime(sr.Time);
}
while( FindNext(sr) == 0 );
FindClose(sr);
}
}
"Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote:
>
>"Brian" <brianb@p3mc.net> wrote in message
>news:412281ad@newsgroups.borland.com...
>
>> I tried the code in the link. It gets an empty list when i login.
>
>Please show your listing code as well.
>
>
>Gambit
>
>
Re: Indy ftp server with c++ HELP PLEASE
Author: me
Date: Thu, 19 Aug 2004 01:56
Date: Thu, 19 Aug 2004 01:56
22 lines
1666 bytes
1666 bytes
Nope, that merely broke the transfers. With that cod ein place, i can no longer successfully send or recieve files (which i could do before). Any other ideas? Do i need to set some property of the object ? Cheers "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote: > >"Brian" <brianb@p3mc.net> wrote in message >news:41228c9c$1@newsgroups.borland.com... > >> if( FindFirst(APath + "*.*", faAnyFile, sr) == 0 ) > >Try changing that to this instead: > > TFtpClient *Client = static_cast<TFtpClient*>(ASender->Data); > > if( FindFirst(IncludeTrailingBackslash(Client->RootPath) + "*.*", >faAnyFile, sr) == 0 ) > > >Gambit > >
Re: Indy ftp server with c++ HELP PLEASE
Author: Remy Lebeau (TeamB)
Date: Thu, 19 Aug 2004 02:06
Date: Thu, 19 Aug 2004 02:06
14 lines
1474 bytes
1474 bytes
"me" <me@me.net> wrote in message news:412408ce$1@newsgroups.borland.com... > Nope, that merely broke the transfers. What are the actual values of the AFileName parameters? > With that code in place, i can no longer successfully > send or recieve files (which i could do before) Do your directory listings work, at least? Gambit
Re: Indy ftp server with c++ HELP PLEASE
Author: me
Date: Thu, 19 Aug 2004 02:48
Date: Thu, 19 Aug 2004 02:48
23 lines
1650 bytes
1650 bytes
I fixed the could not ftp transfer, was something completely different. Nope still no list :/ i am hopeless lol Please another example? "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote: > >"me" <me@me.net> wrote in message news:412408ce$1@newsgroups.borland.com... > >> Nope, that merely broke the transfers. > >What are the actual values of the AFileName parameters? > >> With that code in place, i can no longer successfully >> send or recieve files (which i could do before) > >Do your directory listings work, at least? > > >Gambit > >
Re: Indy ftp server with c++ HELP PLEASE
Author: Remy Lebeau (TeamB)
Date: Thu, 19 Aug 2004 03:28
Date: Thu, 19 Aug 2004 03:28
9 lines
1332 bytes
1332 bytes
"me" <me@me.net> wrote in message news:4124150e$1@newsgroups.borland.com... > Nope still no list :/ Please show your full code again. Gambit
Re: Indy ftp server with c++ HELP PLEASE
Author: me
Date: Thu, 19 Aug 2004 21:20
Date: Thu, 19 Aug 2004 21:20
43 lines
2125 bytes
2125 bytes
-----------------------
TSearchRec sr;
if( FindFirst(APath + "*.*", faAnyFile, sr) == 0 )
{
do
{
TIdFTPListItem *Item = ADirectoryListing->Add();
if( sr.Attr & faDirectory )
Item->ItemType = ditDirectory;
else
Item->ItemType = ditFile;
Item->FileName = sr.Name;
Item->Size = sr.Size;
Item->ModifiedDate = FileDateToDateTime(sr.Time);
delete Item;
}
while( FindNext(sr) == 0 );
FindClose(sr);
}
---------------------
thank you gambit
"Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote:
>
>"me" <me@me.net> wrote in message news:4124150e$1@newsgroups.borland.com...
>
>> Nope still no list :/
>
>Please show your full code again.
>
>
>Gambit
>
>
Re: Indy ftp server with c++ HELP PLEASE
Author: Remy Lebeau (TeamB)
Date: Fri, 20 Aug 2004 18:28
Date: Fri, 20 Aug 2004 18:28
10 lines
1497 bytes
1497 bytes
"me" <me@me.net> wrote in message news:4125198d$1@newsgroups.borland.com... > if( FindFirst(APath + "*.*", faAnyFile, sr) == 0 ) That is not the code I gave you earlier. Did you not make the change to use the RootPath in the listing? Gambit
Re: Indy ftp server with c++ HELP PLEASE
Author: me
Date: Sun, 22 Aug 2004 22:18
Date: Sun, 22 Aug 2004 22:18
17 lines
1676 bytes
1676 bytes
I didnt see . Can you PLEASE repost it here? Thank you "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote: > >"me" <me@me.net> wrote in message news:4125198d$1@newsgroups.borland.com... > >> if( FindFirst(APath + "*.*", faAnyFile, sr) == 0 ) > >That is not the code I gave you earlier. Did you not make the change to use >the RootPath in the listing? > > >Gambit > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads