Back to product page

Connect method


Connects to the server.

Type

Void

Syntax

  • C#
  • VB.NET
public Void Connect();

public Void Connect(String Hostname);
The Connect(Hostname) syntax has these parts:
HostnameHostname of the server.

public Void Connect(String Hostname, Int32 Port);
The Connect(Hostname,Port) syntax has these parts:
HostnameHostname of the server.
PortPort on the server where we will connect.

public Sub Connect()

public Sub Connect(ByVal Hostname As String)
The Connect(Hostname) syntax has these parts:
HostnameHostname of the server.

public Sub Connect(ByVal Hostname As String, ByVal Port As Int32)
The Connect(Hostname,Port) syntax has these parts:
HostnameHostname of the server.
PortPort on the server where we will connect.

Remarks

Connect method will initiate connection between wodSFTP.NET and remote server. It can be used only if wodSFTP.NET is not connected with server at that moment (in other words, if State is set to Disconnected.

If an error occurs during connection, Connected event will be fired with Error parameter set to exception that occurred. If Error is set to null, wodSFTP.NET successfully connected with remote server.
Upon connection, wodSFTP.NET may perform initial 'handshake' with remote server (it will negotiate encryption algorithms and other properties related to secured connection.) If you see your modem lamps flashing and you don't see Connected event yet - don't be worried. It's because wodSFTP.NET did connect and transmits/receives packets for this negotiation.
After handshake is completed, wodSFTP.NET may perform automatic authentication with the server.

Platforms

Windows