NET FTP Library
IsConnected Property
Example 






KellermanSoftware.NetFtpLibrary Namespace > FTP 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 FTP
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
FTP ftp = new FTP(); //Trial Mode            
//FTP ftp = new FTP("place user name here", "place license key here");
 
// set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu"; // a hungarian university. change this to your ftp server
ftp.UserName = "anonymous"; // replace with your user name
ftp.Password = "user@mail.com"; // replace with your password
 
//It should default to false
Console.WriteLine("Connected: {0}", ftp.IsConnected);
 
ftp.Connect();
//We should now be connected
Console.WriteLine("Connected: {0}", ftp.IsConnected);
 
ftp.Disconnect();
//We are now disconnected
Console.WriteLine("Connected: {0}", ftp.IsConnected);
Dim ftp As FTP = New FTP() 'Trial Mode
'FTP ftp = new FTP("place user name here", "place license key here");
 
' set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu" ' a hungarian university. change this to your ftp server
ftp.UserName = "anonymous" ' replace with your user name
ftp.Password = "user@mail.com" ' replace with your password
 
'It should default to false
Console.WriteLine("Connected: {0}", ftp.IsConnected)
 
ftp.Connect()
'We should now be connected
Console.WriteLine("Connected: {0}", ftp.IsConnected)
 
ftp.Disconnect()
'We are now disconnected
Console.WriteLine("Connected: {0}", ftp.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

FTP Class
FTP Members