Connecting to the Server as the Administrator (Connect)

Use the ICIServer interface Connect method to connect to the local or remote server as the administrator.

Signature:

HRESULT Connect([in] BSTR Host, [in] UINT nPort, [in] BSTR Login, [in] BSTR Password);

VB Example:

Dim Server As CIServer 'assumes the SFTPCOMInterface Type Library is referenced by the VB IDE

Dim Site As CISite 'instantiates the ISite interface

Dim Sites As CISites 'instantiates the ISites interface

txtServer = "127.0.0.1" 'local IP address of server

txtPort = "1000" 'admin port

txtUserName = "Admin" 'admin username

txtPassword = "mypass" 'admin password

On Error Resume Next 'verify it could connect ok

Server.Connect txtServer, txtPort, txtUserName, txtPassword 'now connect using supplied information

If Err.Number <> 0 Then

  MsgBox "Error connecting to '" & txtServer & ":" & txtPort & "' -- " & Err.Description & " [" & CStr(Err.Number) & "]", vbInformation, "Error" 'all this on one line!

End If

Set Sites = Server.Sites 'now retrieve the list of sites in the server

Set Site = Sites.Item(0) 'Instantiate the first and only, site (note, this script assumes only one site present)

'continue rest of code...