Hello,
ich habe problems to get the file-size when i want to download a file from a ftp server.
I have the example programm from MicroFocus, i read the description for FTP-Client in the AcuCorp News from 2004. But i didn't get the file-size.
When i send the "RETR" command i should get back the Answer from the Server with the file-size, which i can parse.
I get back:
125 Data connection already open; Transfer starting
but no Info about the File size.
Example from MicroFocus:
initialize unix-send-command
move 1 to unix-send-cmd-length
string "RETR " delimited by size
unix-file-path delimited by spaces
x"0A" delimited by size
into unix-send-command with pointer
unix-send-cmd-length
subtract 1 from unix-send-cmd-length
call "c$socket" using ags-write, unix-connection-handle,
unix-send-command, unix-send-cmd-length
call "c$socket" using ags-flush, unix-connection-handle
|this will receive the server's response to the request
|for copying one of the manager files.
initialize unix-receive-command byte-hold
move 1 to unix-receive-cmd-length
perform until byte-hold = end-cmd-byte or
unix-receive-cmd-length > max-cmd-length
move 1 to num-bytes-read
call "c$socket" using ags-read,
unix-connection-handle, byte-hold, num-bytes-read
string byte-hold delimited by size into
unix-receive-command with pointer
unix-receive-cmd-length
end-perform
end-cmd-byte = 01 end-cmd-byte pic x value x"0A".
When i read the RFC959 Manual for FTP - Server i see here the First Problem.
the responce from the FTP-Server can have a multiply responce and with this code i get only the First line. so i edited the code, that i can receive the full responce from the server.
From the Manual:
Thus the format for multi-line replies is that the first line
will begin with the exact required reply code, followed
immediately by a Hyphen, "-" (also known as Minus), followed by
text. The last line will begin with the same code, followed
immediately by Space <SP>, optionally some text, and the Telnet
end-of-line code.
For example:
123-First line
Second line
234 A line beginning with numbers
123 The last line
the edited code, didn't helped because i get only a single line responce from the server, not a multi-line. So still no file-size answer...
Without the File-Size i can't avoid adding excess bytes to the local file.
My next test was to get the Full List from the Server-Files and Parse the bytes from the listing i get back. But the bytes there are not the same byte-size which i get from c$fileinfo.
At the moment i have no idea to solve my problem.



