FTP programming using Winsock. Possible?
-
First of all, I'm not even sure if the topic makes sense. I'm using native C++ compiler (Dev-C++). Anyway, I'm new to network programming and have been doing little project on network communication between two computers using WinSock (just sending and receiving string). And then I just had an idea whether this kind of "communication" will also work for FTP servers. I tried it on an ftp server on port 21. I requested connection and, to my surprise, I received a welcome message from it. But then I have no clue how to send commands/requests at all (USER or PASS). I would assume the problem is either I don't have the correct string format, or the socket type is just different (I don't have any clue about network types very much). Or maybe Winsock is just not meant for it? Please advise me on what's actually going on. I know there are alot of free libraries out there, but I want to know what's actually happening behind it, in terms of protocols. Thanks! PS: Not sure if this belongs to the correct board, but move it as you wish. Andrew
-
First of all, I'm not even sure if the topic makes sense. I'm using native C++ compiler (Dev-C++). Anyway, I'm new to network programming and have been doing little project on network communication between two computers using WinSock (just sending and receiving string). And then I just had an idea whether this kind of "communication" will also work for FTP servers. I tried it on an ftp server on port 21. I requested connection and, to my surprise, I received a welcome message from it. But then I have no clue how to send commands/requests at all (USER or PASS). I would assume the problem is either I don't have the correct string format, or the socket type is just different (I don't have any clue about network types very much). Or maybe Winsock is just not meant for it? Please advise me on what's actually going on. I know there are alot of free libraries out there, but I want to know what's actually happening behind it, in terms of protocols. Thanks! PS: Not sure if this belongs to the correct board, but move it as you wish. Andrew
Very possible. You're on the right track: it's all about the protocol - what sequence of bytes to send and receive and when to do it. A Google search on "FTP protocol" will get you links to more than you ever wanted to know about FTP. It's been around for a long time :) I think this is the official specification: FILE TRANSFER PROTOCOL (FTP)[^] Mark
-
Very possible. You're on the right track: it's all about the protocol - what sequence of bytes to send and receive and when to do it. A Google search on "FTP protocol" will get you links to more than you ever wanted to know about FTP. It's been around for a long time :) I think this is the official specification: FILE TRANSFER PROTOCOL (FTP)[^] Mark
-
Thanks, Mark! You encouraged me to find the problem why my "USER YYYY" does not produce any reply. It turns out I had the wrong CRLF closing bytes. Now at least I can do USER and PASS. =) It's getting more interesting. Thanks! Andrew