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