|
GetChannelStatus |
|
|
Returns the current communication channel status (closed, open, waiting for TCP connection, or error).
Return Value
Integer
Syntax
result = DL.GetChannelStatus( [channelNo] )
The GetChannelStatus method syntax has these parts:
Remarks
GetChannelStatus returns the following values:
See also SetChannelSettings and GetChannelSettings.
Example
' Example GetChannelStatus ' (requires Docklight in Send/Receive mode)
DL.ClearCommWindows
DL.AddComment "COM port access" DL.SetChannelSettings "COM3:9600,NONE,8,1", 1 DL.AddComment "GetChannelStatus before StartCommunication = " & DL.GetChannelStatus(1) DL.StartCommunication DL.AddComment "GetChannelStatus after StartCommunication = " & DL.GetChannelStatus(1) DL.StopCommunication
DL.AddComment DL.AddComment "TCP client mode" DL.AddComment "Connecting to docklight.de ..." DL.SetChannelSettings "docklight.de:80", 1 DL.StartCommunication ' wait until connected Do commStatus = DL.GetChannelStatus(1) DL.AddComment "GetChannelStatus = " & commStatus DL.Pause 10 Loop Until commStatus <> 2 If commStatus = 1 Then DL.AddComment "Connected." Else DL.AddComment "Error!" End If DL.StopCommunication
After running the script on a computer with a built-in COM3 port (e.g. modem) and Internet connection, the communications window could look like this:
COM port access GetChannelStatus before StartCommunication = 0 GetChannelStatus after StartCommunication = 1
TCP client mode Connecting to docklight.de ... GetChannelStatus = 2 GetChannelStatus = 2 GetChannelStatus = 2 GetChannelStatus = 2 GetChannelStatus = 1 Connected. |