FTP GET - 500 unknown command




    I am a just starter of VB and want to write a simple FTP program. I copied a VB program from a website which contains the following codes;


    Dim commandBytes() As Byte = ASCII.GetBytes(command)

    clientSocket.Send(commandBytes, commandBytes.Length, 0)


    After connection is successfully established,

    the clientSocket.Send above creates '500 unknown command' error for the commands such as PUT, GET, MPUT, MGET etc.

    However it seems to accept the commands such as PORT, PASV, RETR etc, which I don't know how to use.


    Could anyone tell me how to make PUT, GET work?   


    Thanks in advance.

    Thursday, October 25, 2007 9:08 PM

All replies

  • Did you try to connect to the ftp server with a client ftp or the windows ftp command ?

    Friday, October 26, 2007 8:30 AM
  • GET and PUT are commands used by many command-line ftp utilities, but it turns out that they are not the commands that the actual protocol uses (RETR and STOR, respectively).  You can find a full list in sections 3 and 4 of the official specification.


    If you're simply interested in getting an FTP client working, take a look at System.Net.FtpWebRequest class.  If you're in it for the learning experience, then good luck and let us know if you run into any other questions.  Smile



    Friday, October 26, 2007 9:30 PM
  • Thanks Dave for your suggestion. It saves me from going in the wrong direction.

    Saturday, October 27, 2007 1:38 AM