Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / IbmTerminal Object / Connect Method
Example
In This Topic
    Connect Method (IbmTerminal)
    In This Topic
    Connects to the host.
    Syntax
    expression.Connect() As ReturnCode
    where expression is a variable that represents a IbmTerminal Object

    Return Value

    One of the following ReturnCode enumeration values.

    Member Description
    Cancelled Cancelled.
    Error Error.
    PermissionRequired Permission is required.
    Success Success.
    Timeout Timeout condition.
    Truncated The text is truncated.

    Remarks
    This method returns an error if the connection cannot be made successfully or is ignored if a connection already exists. Use the IsConnected property to determine if a connection already exists. Use HostCommTimeout to specify how many seconds Reflection should wait for a host response.

    For more about using the Connect method, see:

    Handle TLS Authentication

     

    Example
    This sample changes an unsecure Telnet Connecion to TLS 1.2. To run this sample, open a non-secure 3270 Telnet session and copy the code into a code module. Then change the host name and port for a secure connection and run the macro.
    Sub setSecurity()
       
       'Make sure the terminal is disconnected before changing settings
        With ThisIbmTerminal
            If .IsConnected = True Then
            .Disconnect
            End If
            
            'enter host that supports TLS
            .HostAddress = "yourHost"
            
            .EnableTelnetEncryption = True
            .TLS_SSLVersion = TLSSSLVersionOption_TLS_V1_2
            
            'Specify that the host name in the certificate must match the name of the host you are connecting to
            .TelnetEncryptionVerifyHostName = True
            
            'You may need to set additional properties to connect, depending on your host configuration.
            'For example, you may need to select a set of custom ciphers in the Security Properties dialog box
            'and then specify to use them as shown below
                    
            '.TelnetEncryptionStrength = TelnetEncryptionStrengthOption_Custom
            
            'Replace with your secure port
            .port = yourport
            
            'Connect after changing the settings
            .Connect
            
        End With
            
    End Sub
    See Also