Show Contents / Index / Search

Methods and Properties for Connection Macros

When creating a connection macro, do the following:

  • Use the Connect method to establish a host connection.
  • Use the Disconnect method to disconnect from the host. (This makes the serial port available to other sessions and applications for direct serial or modem connections.)
  • Set the ConnectionSettings property DropDTROnDisconnect to False to maintain the DTR (data terminal ready) signal after you disconnect a serial connection or quit Reflection 2008. This prevents the modem from hanging up and lets you resume your Reflection 2008 session.

    Note: The Connect method will return an error if the host is already connected. Similarly, the Disconnect method will return an error if the host is already disconnected. To prevent Connect errors, use the IsConnected property to determine if a connection is active. To prevent Disconnect errors, write an error-handling routine for hosts that automatically close connections when you log out.

Example

This example configures a connection and then uses the Connect method to open the connection before waiting for a host prompt. If the host prompt is not received after 10 seconds, the connection is closed.

Sub MakeMyConnection ()

Dim isFound As Integer
Dim timeOut As Integer
timeOut = 10

With ThisTerminal

If .IsConnected = False Then
.ConnectionType = "VT-MGR"
.ConnectionSettings.HostAddress = "MyIBMHost"
.Connect
isFound = .WaitForString("MPE XL:", timeOut, rcAllowKeystrokes)
If isFound = False Then
.Disconnect
End If
Else
MsgBox("There is already a connection open.", vbOKCancel) = vbNo Then


End If
End With
End Sub