🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
I need some help with FTP
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
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.
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement