Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about FTP log file

50 views
Skip to first unread message

Scott Coffey

unread,
May 22, 2012, 4:02:42 PM5/22/12
to
I wrote a small program to test the FTP functionality in xHarbour.
Here is the code:

*************************************************
#include "tip.ch"
procedure main
local oftp
local csite := "ftp://user:pa...@host.com"
local cfile := "data.zip"

oFtp := tIPClientFtp():New( csite, .T. )

if .not. oftp:open()
? oftp:lasterrormessage()
quit
endif

oFtp:UpLoadFile((cFile))
oFtp:close()

return(nil)
*************************************************

The file being sent is only 1K. The program executes in only 4
seconds, but it should take less than half that. If I use a WS_FTP
Pro script, it runs in about 2 seconds and that script actually has a
bunch of extra overhead.

Here is the Harbour log file for the FTP session:

*******************************************************************

20120522-15:31:54 :INETCONNECT( host.com, 21 )
>> 15F7E8 <<

20120522-15:31:54 :INETERRORCODE( 15F7E8 )
>> 0 <<

20120522-15:31:54 :INETRECVLINE( 15F7E8, , 128 )
>> 220-QTCP at host.com. <<

20120522-15:31:54 :INETRECVLINE( 15F7E8, , 128 )
>> 220 Connection will close if idle more than 5 minutes. <<

20120522-15:31:54 :INETERRORCODE( 15F7E8 )
>> 0 <<

20120522-15:31:54 :INETSENDALL( 15F7E8, 12, USER user )
>> 12 <<

20120522-15:31:54 :INETRECVLINE( 15F7E8, , 128 )
>> 331 Enter password. <<

20120522-15:31:54 :INETERRORCODE( 15F7E8 )
>> 0 <<

20120522-15:31:54 :INETSENDALL( 15F7E8, 16, PASS pass )
>> 16 <<

20120522-15:31:54 :INETRECVLINE( 15F7E8, , 128 )
>> 230 user logged on. <<

20120522-15:31:54 :INETERRORCODE( 15F7E8 )
>> 0 <<

20120522-15:31:54 :INETSENDALL( 15F7E8, 8, TYPE I )
>> 8 <<

20120522-15:31:54 :INETRECVLINE( 15F7E8, , 128 )
>> 200 Representation type is binary IMAGE. <<

20120522-15:31:54 :INETERRORCODE( 15F7E8 )
>> 0 <<

20120522-15:31:57 :INETRECVLINE( 15F7E8, , 128 )
>> NIL <<

20120522-15:31:57 :INETSENDALL( 15F7E8, 6, PASV )
>> 6 <<

20120522-15:31:57 :INETRECVLINE( 15F7E8, , 128 )
>> 227 Entering Passive Mode (75,77,76,146,93,42). <<

20120522-15:31:57 :INETERRORCODE( 15F7E8 )
>> 0 <<

20120522-15:31:57 :INETSENDALL( 15F7E8, 15, STOR data.zip )
>> 15 <<

20120522-15:31:57 :INETERRORCODE( 176638 )
>> 0 <<

20120522-15:31:57 :INETRECVLINE( 15F7E8, , 128 )
>> 150 Sending file to /data.zip <<

20120522-15:31:57 :INETERRORCODE( 15F7E8 )
>> 0 <<

20120522-15:31:57 :INETSENDALL( 176638, 4, zxcv )
>> 4 <<

20120522-15:31:58 :INETRECVLINE( 15F7E8, , 128 )
>> 250 File transfer completed successfully. <<

20120522-15:31:58 :INETERRORCODE( 15F7E8 )
>> 0 <<

**************************************************************

Could anyone shed some light on what's happening between 15:31:54 and
15:31:57?

It looks like the delay is due to an extra "receive" after informing
the host that the data type is binary (Type I). Right here:

20120522-15:31:54 :INETSENDALL( 15F7E8, 8, TYPE I )
>> 8 <<

20120522-15:31:54 :INETRECVLINE( 15F7E8, , 128 )
>> 200 Representation type is binary IMAGE. <<

20120522-15:31:54 :INETERRORCODE( 15F7E8 )
>> 0 <<

20120522-15:31:57 :INETRECVLINE( 15F7E8, , 128 )
>> NIL <<

What is that 2nd receive where there is a "NIL" response?
--
ScottCoffey at Scott dash(-) Coffey dot net

Claudio Herszage

unread,
May 23, 2012, 12:02:20 AM5/23/12
to
Scott

> Could anyone shed some light on what's happening between 15:31:54 and
> 15:31:57?
It's a timeout waiting for the FTP to send anything else.

> What is that 2nd receive where there is a "NIL" response?
It's the timed out receive that received nothing.

Check docs to see if you can decrease that timeout.

Regards
Claudio H

Scott Coffey

unread,
May 24, 2012, 7:12:15 AM5/24/12
to
On Tue, 22 May 2012 21:02:20 -0700 (PDT), Claudio Herszage
<cla...@herszage.com> wrote:

>Scott
>
>> Could anyone shed some light on what's happening between 15:31:54 and
>> 15:31:57?
>It's a timeout waiting for the FTP to send anything else.
>
>> What is that 2nd receive where there is a "NIL" response?
>It's the timed out receive that received nothing.
>
>Check docs to see if you can decrease that timeout.

I'm not sure what docs to check. There is sparse info on the FTP
process in the Harbour documentation available here. What little I
gleaned was from finding other people's examples.

This is part of the "handshake" isn't it? We had requested binary
mode and the host responded with "OK", so why is the client waiting
for another response from the host that will never come?

And wouldn't a timeout be longer than three seconds? I can't see
where to set the length of the timeout, but I would imagine the
default would be something more than three seconds.

cul...@gmail.com

unread,
May 24, 2012, 12:22:16 PM5/24/12
to
Scott

post the code you use to acess ftp with xharbour

Regards
Luiz

On 24 maio, 08:12, Scott Coffey <n...@noemail.com.invalid> wrote:
> On Tue, 22 May 2012 21:02:20 -0700 (PDT), Claudio Herszage
>

Scott Coffey

unread,
May 25, 2012, 9:29:29 AM5/25/12
to
On Thu, 24 May 2012 09:22:16 -0700 (PDT), "cul...@gmail.com"
<cul...@gmail.com> wrote:

>Scott
>
>post the code you use to acess ftp with xharbour
>
>Regards
>Luiz

Copied from OP:

*************************************************
#include "tip.ch"
procedure main
local oftp
local csite := "ftp://user:pa...@host.com"
local cfile := "data.zip"

oFtp := tIPClientFtp():New( csite, .T. )

if .not. oftp:open()
? oftp:lasterrormessage()
quit
endif

oFtp:UpLoadFile((cFile))
oFtp:close()

return(nil)
*************************************************
0 new messages