How to find ftp server supports NOOP(KeepAlive) command.

+1 vote
asked Dec 18, 2014 by ganeshspy (900 points)
edited Dec 19, 2014

How to find ftp server supports NOOP(KeepAlive) command.

Applies to: Rebex FTP/SSL, Rebex SFTP

1 Answer

+1 vote
answered Dec 18, 2014 by Tomas Knopp (58,890 points)
edited Dec 19, 2014

The best would be to use the Ftp.SendCommand and Ftp.ReadResponse to send the "NOOP" command to the server and then check whether it was successful (response code will start with "2" in this case). Just make sure to connect and authenticate to the FTP server before detecting the NOOP command support. Here is the code which does it:

Ftp ftp = new Ftp();

ftp.Connect("ftp_server");
ftp.Login("username", "password");

bool noopSupported = false;

ftp.SendCommand("NOOP");
var response = ftp.ReadResponse();
if (response.Group == 2)
{
    Console.WriteLine("NOOP command is supported.");
}
else
{
    Console.WriteLine("NOOP command not supported.");
}

ftp.Disconnect();
commented Dec 19, 2014 by ganeshspy (900 points)
edited Dec 19, 2014

Thanks....

...