Your problem is you don't log into the ftp server and prepare it for filetransfer.
Posted on 2001-07-23 20:39:11 by Zynaps
ummm were's the connection to port 20?... that's the port used for data transfer with ftp... port 21 is just used for the "telnet" commands... such as retr, stor, user, pass and so on... my tip would be either read the RFC (available on ) or use the wininet functions... wich is a lot simpler btw
Posted on 2001-07-24 02:47:13 by NervGaz

i found winsock very difficult to get to grips with at first, but once you understand all the API's involved (which there arent that many of) then its really not that hard at all. i sugest you have a read of "Iczelion's Guide To Winsock Programming" which can be found here:

when using any protocol such as FTP, SMTP, POP3, HTTP etc. you have to understand how the client and server communicate. i had a similar problem when trying to send an email (SMTP). what you are doing is correct but you have to tell the server that basically your going to send the file, and give it a few other bits of information it needs to sucessfully receive the file. then you can begin to send the file.

also, why not try doing all this in blocking mode and hard coding everything? once you have done this you can add all the other bits you already know how to do.

i hope this helps.
Posted on 2001-07-24 05:23:56 by skud
Why not just use the WinInet lib? It has simple ftp send and receive commands... and also stuff for http/socks etc.

Instead of 50 lines of code it takes 3.


Of course if you just like reinventing the wheel ignore me...
Posted on 2001-07-25 18:21:57 by Unregistered

yeah, sure you can use WinInet and it will work fine. but it doesnt show you how to use send or give you an understanding of how the FTP protocol works. I don't know about smurf, but when i write any code my main objective is to learn something, and the end result happens to be a nice side effect ;).

Posted on 2001-07-26 04:10:18 by skud
well said skud.:alright: using winsock will be much more flexable anyways. im not the kinda of guy who will use a resouce editor instead of coding my controls and such by hand. i dont code fast because if i did i would use visual basic. so i use asm and i like to understand whats going on behind the scenes. yes i did say i wanted to code a simple ftp client but thats cuz i dont know anything about it and i want to get a clear understanding of what im doing and what really going on behind the scenes. anyways i still dont know how to connect to an ftp properly and send something. someone wanna give me some babysteps.
Posted on 2001-07-26 18:52:34 by smurf
Fully agree here as well, I write code for each internet protocol I use myself.. But I've never done FTP though. Try using an existing FTP client that shows you what commands it sends. I believe it's something like this but I'm not sure as I've never worked with it:
- connect to port 21 on a FTP server
- send USER username
- send PASS password
- then you can use some basic commands like change directory (CWD /path.
- To actually send the file, I think you'll have to start a server on the client computer, and give the FTP server the address+IP of that server so it can connect to it and read/send data. Look this up in the RFC, i'm not sure about it. It has to do with PORT. STOR and RETR commands.

Hope this helps,
Posted on 2001-07-27 02:38:34 by Thomas