Archived

This topic is now archived and is closed to further replies.

Neo_Matrix

I need some help with FTP

Recommended Posts

Neo_Matrix    122
Hey All. I am programming an application for school and I am trying to set up an FTP connection. Can someone point me to a good reference/tutorial on starting an FTP connection. Or can someone post some code to get it set up and connected. I really appreciate this. Thanks. Neo_Matrix

Share this post


Link to post
Share on other sites
Sordith    181
Go Here for RFC959 (RFC on the ftp protocol). I used this information to write a FTP client a while back. Something to note: to transfer files you must make a second connection and send through that.

Share this post


Link to post
Share on other sites
win32mfc    122
Yes, RFC 959 will help you on your way. I wrote an FTP Server and also a Client from just reading that RFC.

Basically, doing everything yourself, this is how a "get file from an ftp site" would go:

(1) Connect to server
(2) Login
(3) send "TYPE I" or "TYPE A" (for binary or Ascii transfer)
(4) send either a "PORT" command (if you want the remote FTP server to connect to YOU to send the file) or send a "PASV" command (if you want the remote FTP server to provide a port for YOU to connect to; to get the file)
(5) send the "RETR" command to specify the file you want to get
(6) if using PASV mode, connect to the server-provided address/port; if using the PORT command, wait for the server to connect to you and send the file.

It''s not trivial to implement, and there''s plenty of third-party controls available that will do it for you. For sample code, there is probably something at CodeGuru.com - if you''re using Windows, you might consider using the WinINet library... With that, you won''t have to worry about the details; just connect and say "get file" (basically.)

Hope that helps..

// CHRIS

Share this post


Link to post
Share on other sites