NET SFTP Library
IsConnected Property
Example 






KellermanSoftware.NetSFtpLibrary Namespace > SFTP Class : IsConnected Property
Returns true if we are connected to the FTP server.
Syntax
'Declaration
 
Public ReadOnly Property IsConnected As System.Boolean
'Usage
 
Dim instance As SFTP
Dim value As System.Boolean
 
value = instance.IsConnected
public System.bool IsConnected {get;}
public read-only property IsConnected: System.Boolean; 
public function get IsConnected : System.boolean
public: __property System.bool get_IsConnected();
public:
property System.bool IsConnected {
   System.bool get();
}
Example
SFTP sftp = new SFTP(); //Trial Mode            
//SFTP sftp = new SFTP("place user name here", "place license key here");
 
// set the name of the SFTP server( its URL )
sftp.HostAddress = "some.sftp.server.com";
sftp.UserName = "anonymous"; // replace with your user name
sftp.Password = "user@mail.com"; // replace with your password
 
//It should default to false
Console.WriteLine("Connected: {0}", sftp.IsConnected);
 
sftp.Connect();
//We should now be connected
Console.WriteLine("Connected: {0}", sftp.IsConnected);
 
sftp.Disconnect();
//We are now disconnected
Console.WriteLine("Connected: {0}", sftp.IsConnected);
Dim sftp As SFTP = New SFTP() 'Trial Mode
'Dim sftp = New SFTP("place user name here", "place license key here")
 
' set the name of the SFTP server( its URL )
sftp.HostAddress = "some.sftp.server.com"
sftp.UserName = "anonymous" ' replace with your user name
sftp.Password = "user@mail.com" ' replace with your password
 
'It should default to false
Console.WriteLine("Connected: {0}", sftp.IsConnected)
 
sftp.Connect()
'We should now be connected
Console.WriteLine("Connected: {0}", sftp.IsConnected)
 
sftp.Disconnect()
'We are now disconnected
Console.WriteLine("Connected: {0}", sftp.IsConnected)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

SFTP Class
SFTP Members