SFTP runs over SSH. To determine whether a server is listening at a particular port, just try connecting it using System.Net.Sockets.Socket class and receive the identification string.
If you would like to determine that an SSH server is really up and running, you can use Rebex
SshSession class to connect to the server and negotiate an SSH session. If this works, the server is up and running. If it doesn't, there is an issue and you can use
Status property to determine what's going on. However, this of course doesn't really determine whether the SFTP subsystem for a particular user would work. The only reasonable way to determine that would be to authenticate as well and try establishing an SFTP channel (in other words, to call
Connect method followed by
TFTP is a very old and very simple file transfer protocol that runs over UDP. To determine if it's running, hopefully you could send a request and wait for proper response according to the protocol. However, we currently don't provide any TFTP library and are not familiar with the protocol, so this is outside the scope of our support.
As for Modbus - if you use Modbus over SSH, what I wrote about SFTP would apply as well. Otherwise, to determine whether a Modbus over TCP is availalbe, again try connecting to it using