online source control
back to content
sign up free version control plan

ISAWHAppObject::ConnectToServer

Description

Connects to Dynamsoft SourceAnywhere Hosted Server directly or through your cache server.

Syntax

long ConnectToServer(
        long
OrganizationID,
        VARIANT_BOOL
UseCacheServer,
        VARIANT_BOOL
UseSSL,
        BSTR
CacheServerAddress,
        long
CacheServerPort,
        Enum_ProxyType
ProxyType,
        BSTR
ProxyAddress,
        long
Proxyport,
        BSTR
ProxyUserName,
        BSTR
ProxyPassword,
        Enum_EncryptType*
EncryptType,
        ISAWHGlobalMessageSet*
GlobalMessageSet,
        BSTR *
PlanName,
        VARIANT_BOOL
*Cancelled,
        BSTR*
ResultDescription
);

Parameters

OrganizationID
[in] Specifies the organization ID that is part of your hosted account identity.

UseCacheServer
[in] Specifies whether to connect to hosted server through your cache server.

UseSSL
[in] Specifies whether to connect to SSL encrypted port.

CacheServerAddress
[in] Specifies the domain name or IP address of your cache server if it is used.

CacheServerPort
[in] Specifies the port of your cache server if it is used.

ProxyType
[in] Specifies the type of the proxy server.

ProxyAddress
[in] Specifies the IP or domain name of proxy server (if proxy is used).

Proxyport
[in] Specifies the port of proxy server (if proxy is used).

ProxyUserName
[in] Specifies the identification used to login the proxy server (if proxy is used and requires authentication).

ProxyPassword
[in] Specifies the password for the user to login the proxy sever (if proxy is used and requires authentication).

EncryptType
[out] Returns the encryption type.

GlobalMessageSet
[out] Returns the global messages received from Dynamsoft SourceAnywhere Hosted Server.

PlanName
[out] Returns the plan name of your hosted account.

Cancelled
[out] If the method fails, returns whether the operation is cancelled.

ResultDescription
[out] Returns the description of the result. If the operation succeeds, returns 'Completed'. If the operation fails, returns the error information.

Return Value

If the method succeeds, returns 0. If the method fails, returns other error codes.

See Also

Sample

VB Sample:

Dim WithEvents sdkObject As SAWHSDKLib.SAWHAppObject

Set sdkObject = New SAWHSDKLib.SAWHAppObject

Private Sub ConnectToServer_Click()

	Dim OrganizationID As Long
	ServerIP = 111
	Dim ServerPort As Long
	ServerPort = 7788

	Dim GlobalMessageSet As New ISAWHGlobalMessageSet
	Dim EncryptType As Enum_EncryptType
	Dim PlanName As String
	Dim Cancelled As Boolean
	Dim ResultDescription As String

	Dim ResultValue As Long

	ResultValue = sdkObject.ConnectToServer(OrganizationID, False, False, "", 0, Enum_NOPROXY, "", 0, "", "", EncryptType, GlobalMessageSet, PlanName, Cancelled, ResultDescription)

	If ResultValue <> 0 Then
		MsgBox ("Failed to connect to server.")
	End If 

End Sub