🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
12 messages
12 total messages Started by David Ayre Mon, 13 Mar 2006 09:17
FTP with Indy Components
#2587
Author: David Ayre
Date: Mon, 13 Mar 2006 09:17
13 lines
1212 bytes
Hi,

I am using BDS 2006 which has all the Indy components and would
like to use the FTP client to send a file from my application to
my website and to download another file, but I'm not sure which
components I need to use and how to set them up etc.
Is there a tutorial I could look at, or has someone some sample
code to get me started, please.

Thanks,

David
Re: FTP with Indy Components
#2592
Author: Remy Lebeau (TeamB)
Date: Mon, 13 Mar 2006 20:28
13 lines
1267 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:441546a6$1@newsgroups.borland.com...

> I ... would like to use the FTP client to send a file from my
> application to my website and to download another file, but
> I'm not sure which components I need to use

Considering that you want to work with the client side of the FTP protocol,
you would use the client-side FTP component - TIdFTP.


Gambit
Re: FTP with Indy Components
#2606
Author: David Ayre
Date: Tue, 14 Mar 2006 08:13
24 lines
1525 bytes
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>news:441546a6$1@newsgroups.borland.com...
>
>> I ... would like to use the FTP client to send a file from my
>> application to my website and to download another file, but
>> I'm not sure which components I need to use
>
>Considering that you want to work with the client side of the FTP protocol,
>you would use the client-side FTP component - TIdFTP.
>
>
>Gambit
>
>
Thanks Remy,

I wasn't sure whether it needed any other components to work with it. I assume from your reply that it doesn't.

Cheers,

David
Re: FTP with Indy Components
#2607
Author: David Ayre
Date: Tue, 14 Mar 2006 15:38
33 lines
1816 bytes
Can anyone point me to some code examples using TIdFTP to
transfer a file from aan application to and from a website?

Thanks,

David

"David Ayre" <davidcayre@ntlworld.com> wrote:
>
>"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>>
>>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>>news:441546a6$1@newsgroups.borland.com...
>>
>>> I ... would like to use the FTP client to send a file from my
>>> application to my website and to download another file, but
>>> I'm not sure which components I need to use
>>
>>Considering that you want to work with the client side of the FTP protocol,
>>you would use the client-side FTP component - TIdFTP.
>>
>>
>>Gambit
>>
>>
>Thanks Remy,
>
>I wasn't sure whether it needed any other components to work with it. I assume from your reply that it doesn't.
>
>Cheers,
>
>David
Re: FTP with Indy Components
#2608
Author: Remy Lebeau (TeamB)
Date: Tue, 14 Mar 2006 17:25
14 lines
1391 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:4416892c$1@newsgroups.borland.com...

> I wasn't sure whether it needed any other components
> to work with it. I assume from your reply that it doesn't.

That depends on what you want to do with it exactly.  It can be used by
itself.  It can be combined with an SSL IOHandler in order to enable
encrypted connections.  It can be combined with a Compression Intercept to
enable compressed transfers.


Gambit
Re: FTP with Indy Components
#2610
Author: David Ayre
Date: Tue, 14 Mar 2006 17:25
28 lines
1841 bytes
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>news:4416892c$1@newsgroups.borland.com...
>
>> I wasn't sure whether it needed any other components
>> to work with it. I assume from your reply that it doesn't.
>
>That depends on what you want to do with it exactly.  It can be used by
>itself.  It can be combined with an SSL IOHandler in order to enable
>encrypted connections.  It can be combined with a Compression Intercept to
>enable compressed transfers.
>
>
>Gambit
>
>
Hi Remy,

I want to be able to upload a file to my website and download
another from an application. The file name will be fixed and
it will only be to the one site.
As to the other point, I haven't tried the Indy examples. Where can I find them?

Cheers,

David
Re: FTP with Indy Components
#2609
Author: Remy Lebeau (TeamB)
Date: Tue, 14 Mar 2006 17:25
11 lines
1223 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:4416f185$1@newsgroups.borland.com...

> Can anyone point me to some code examples using TIdFTP
> to transfer a file from aan application to and from a website?

Did you look at Indy's own demos yet?


Gambit
Re: FTP with Indy Components
#2613
Author: Remy Lebeau (TeamB)
Date: Wed, 15 Mar 2006 01:13
17 lines
1491 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:44170a95$1@newsgroups.borland.com...

> I want to be able to upload a file to my website and download
> another from an application. The file name will be fixed and
> it will only be to the one site.

Ok, so what exactly are you having a problem with?

> As to the other point, I haven't tried the Indy examples.
> Where can I find them?

On Indy's website.


Gambit
Re: FTP with Indy Components
#2614
Author: David Ayre
Date: Wed, 15 Mar 2006 08:34
17 lines
1385 bytes

>Ok, so what exactly are you having a problem with?

I just don't know where to start.

>> As to the other point, I haven't tried the Indy examples.
>> Where can I find them?
>
>On Indy's website.

Thanks. I'll have a look at that. it will probably tell me what I
want to know.

Cheers,

David
Re: FTP with Indy Components
#2617
Author: Remy Lebeau (TeamB)
Date: Wed, 15 Mar 2006 18:00
10 lines
1316 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:4417dfa2$1@newsgroups.borland.com...

> I just don't know where to start.

The documenation is a good place to start.


Gambit
re:FTP with Indy Components
#2622
Author: adelacu
Date: Fri, 17 Mar 2006 00:03
124 lines
5222 bytes
To start an Indy FTP uploading function do the following:
1.- Insert Indy FTP component in the main Form
2.- Press F1 (help) to learn about it, you may see below some examples
working asyncronous (events).

void ftp_indy_connect( void )
{
glob_ftp.tocc = 0;
Form1->IdFTP1->Host = glob_genconfig.ftp;
Form1->IdFTP1->Port = 21;
Form1->IdFTP1->User = glob_genconfig.ftpusr;
Form1->IdFTP1->Password = glob_genconfig.ftppsw;
Form1->IdFTP1->Connect(4000);
}

void ftp_indy_oper( void )
{
char st1[MAXSTRING];

switch ( glob_ftpstat )
       {
       case FTP_NC:     // Sin conexi�n
            Form1->FTP_Status->Font->Color = clBlack;
            Form1->FTP_Status->Caption =
glob_ftpmsg[0*2+glob_leng];
            if ( (glob_popstat != POP_NC) || (glob_smstat != SM_NC) )
               break;
            if ( (glob_xxfptrin != glob_xxfptrout) &&
(glob_ftp.send != 0) )
               {
               glob_ftpstat = FTP_IC;
               glob_ftp.tocc = 0;
               ftp_indy_connect();
               }
            break;

       case FTP_IC:     // Espera conexi�n
            glob_ftp.tocc++;
            sprintf( st1, "%s: ",
glob_ftpmsg[2*2+glob_leng], glob_ftp.tocc);
            Form1->FTP_Status->Font->Color = clRed;
            Form1->FTP_Status->Caption = st1;
            if ( glob_ftp.tocc >= (glob_ftp.tomax * TTIMERD))
               {
               kprint( glob_ftpmsg[34*2+glob_leng] );
               glob_ftpstat = FTP_NC;
               glob_ftp.send = 0;
               }
            break;

       case FTP_RCON:   // Reci�n conectado
            Form1->FTP_Status->Font->Color = clGreen;
            Form1->FTP_Status->Caption = "Inicia
estabilizaci�n";
            glob_ftpstat = FTP_WSD;
            glob_ftp.tocc = 0;
            break;

       case FTP_WSD:    // Espera que conexi�n se estabilice
            glob_ftp.tocc++;
            Form1->FTP_Status->Font->Color = clGreen;
            Form1->FTP_Status->Caption = "Espera conexi�n
estable";
            if ( glob_ftp.tocc >= 20)
               {
               glob_ftpstat = FTP_001;
               Form1->IdFTP1->ChangeDir(glob_ftp2[
glob_xxfptrout ].dir);
               glob_ftp.tocc = 0;
               }
            if ( glob_ftp.connect == 0 )
               glob_ftpstat = FTP_NC;
            break;

       case FTP_001:    // Espera cambio de directorio
            Form1->FTP_Status->Font->Color = clGreen;
            Form1->FTP_Status->Caption = "Espera cambio
directorio";
            glob_ftp.tocc++;
            if ( glob_ftp.tocc >= 10)
               {
               glob_ftpstat = FTP_002;
               }
            break;

       case FTP_002:    // Cambio de directorio bien
            Form1->FTP_Status->Font->Color = clGreen;
            Form1->FTP_Status->Caption = "Inicia
upload";
            glob_ftpstat = FTP_003;
            Form1->IdFTP1->Put(glob_ftp2[ glob_xxfptrout
].file_local, glob_ftp2[ glob_xxfptrout ].file_remote, false);
            glob_ftp.tocc = 0;
            break;

       case FTP_003:    // Espera upload de archivo
            Form1->FTP_Status->Font->Color = clGreen;
            Form1->FTP_Status->Caption = "Espera
upload";
            glob_ftp.tocc++;
            if ( glob_ftp.tocc >= 1000)
               {
               Form1->IdFTP1->Abort();
               ftp_indy_end();
               }
            break;

       case FTP_IDE:    // Espera desconexi�n
            Form1->FTP_Status->Font->Color = clRed;
            Form1->FTP_Status->Caption = "Espera
desconexi�n";
            if ( glob_ftp.connect == 0 )
               glob_ftpstat = FTP_NC;
            break;

       case FTP_DES:    // Inicia desconexi�n
            glob_xxfptrout++;
            if ( glob_xxfptrout == EQTOT )
               glob_xxfptrout = 0;
            glob_fdaysent++;
            ftp_indy_end();
            break;
       }
}
Re: FTP with Indy Components
#2624
Author: David Ayre
Date: Fri, 17 Mar 2006 13:12
28 lines
1911 bytes
Hi Remy,

I have downloaded the demos and found them very helpful. I find it
a lot easier and get a lot more info from a code example that I
do from a set of definitions. Perhaps the documentation that I
have is not all that is available, but it is fine if you are
already familiar with the components and know how to use them.
Although the demos were in Delphi they allowed me to write my
own code very quickly, in bds 2006 and get it working.

Thanks for the help,

David

"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>news:4417dfa2$1@newsgroups.borland.com...
>
>> I just don't know where to start.
>
>The documenation is a good place to start.
>
>
>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