Hello all...
I know this question is better suited for the Internet forum but I thought I would get quicker results from this forum due to its popularity.
I have been writing a small FTP client and have encountered a problem reading the response messages in a reliable way from the server. After I have sent in the login information and have read what appears to be the END of the "login message", I would then send the PASV command. On some servers (particularly Microsoft FTP services), when I tried to read the response from the PASV command I ended up getting more "login message" data.
Here is an example of what I mean:
----------------------------------
tcp print hcmd, "USER anonymous"
do until eof(hcmd)
tcp line hcmd, buffer
msgbox buffer
loop
tcp print hcmd, "PASS [email protected]"
do until eof(hcmd)
tcp line hcmd, buffer
msgbox buffer
loop
tcp print hcmd, "PASV"
do until eof(hcmd)
tcp line hcmd, buffer
msgbox buffer
loop
** At this point, on some servers, there would still be some message data available from the previous command "PASS". I didnt think that this could be, because I used the "do until eof" to ensure that all the data sent would be read in. I have also tried to use "tcp recv, 65536, buffer" as a bulk read, but this ended up chopping the message up in little chunks. I have looked at the PBFTP example but that seems to rely on a specific string to exit the read loop.
If someone could shed some light on this I would greatly appreciate it.
Cheers!
I know this question is better suited for the Internet forum but I thought I would get quicker results from this forum due to its popularity.
I have been writing a small FTP client and have encountered a problem reading the response messages in a reliable way from the server. After I have sent in the login information and have read what appears to be the END of the "login message", I would then send the PASV command. On some servers (particularly Microsoft FTP services), when I tried to read the response from the PASV command I ended up getting more "login message" data.
Here is an example of what I mean:
----------------------------------
tcp print hcmd, "USER anonymous"
do until eof(hcmd)
tcp line hcmd, buffer
msgbox buffer
loop
tcp print hcmd, "PASS [email protected]"
do until eof(hcmd)
tcp line hcmd, buffer
msgbox buffer
loop
tcp print hcmd, "PASV"
do until eof(hcmd)
tcp line hcmd, buffer
msgbox buffer
loop
** At this point, on some servers, there would still be some message data available from the previous command "PASS". I didnt think that this could be, because I used the "do until eof" to ensure that all the data sent would be read in. I have also tried to use "tcp recv, 65536, buffer" as a bulk read, but this ended up chopping the message up in little chunks. I have looked at the PBFTP example but that seems to rely on a specific string to exit the read loop.
If someone could shed some light on this I would greatly appreciate it.
Cheers!
Comment