This sample script is a simple one way relay that will allow you to take data that was received from one connection and send it out another.
For example you can forward an incoming telnet connection out through a separate RS-232 serial connection.

If you need a full two-way relay connection check out our two way relay sample script

Set inHaw = CreateObject("HAWin32")
Set outHAW = CreateObject("HAWin32")
Set inScript = inHaw.haInitialize("input")
Set outScript = outHAW.haInitialize("output")

inScript.haSizeHyperACCESS 3
outScript.haSizeHyperACCESS 3

inScript.haSetMessageTimer 0
outScript.haSetMessageTimer 0

inScript.haOpenSession "simplehost.HAW"
inScript.haConnectSession 4
While inScript.haGetConnectionStatus = 5
inScript.haWaitForConnection 1, 1000
If inScript.haGetConnectionStatus = 1 Then
outScript.haOpenSession "com 1.HAW"
outScript.haConnectSession 0
outScript.haWaitForConnection 1, 10000
While(inScript.haGetConnectionStatus = 1 And outScript.haGetConnectionStatus = 1)
datastr = inScript.haGetInput(0, -1, 2500, 1000)
If datastr <> "" Then
outScript.haTypeText datastr
End If
wend
outScript.haDisconnectSession
outScript.haWaitForConnection 2, 1000
outScript.haCloseSession

inScript.haDisconnectSession
inScript.haWaitForConnection 2, 1000
datastr = ""
inScript.haConnectSession 4
End If
wend
inScript.haTerminate
outScript.haTerminate

To reverse the direction of the data replace the while loop with the following

While(inScript.haGetConnectionStatus = 1 And outScript.haGetConnectionStatus = 1)
datastr = outScript.haGetInput(0, -1, 2500, 1000)
If datastr <> "" Then
inScript.haTypeText datastr
End If
wend

Return to sample script index

Hilgraeve