<< Click to Display Table of Contents >> Navigation: Reference (Scripting) > Side Channels - Using Multiple Data Connections > OpenSideChannel / CloseSideChannel - Managing multiple channels |
The OpenSideChannel / CloseSideChannel methods allow using multiple additional data connections in one Docklight Scripting instance. Incoming data from side channels can be distinguished / labeled using the rxChannelTag argument Transmitting data on side channels is possible via the DirectSend method.
DL Methods for side channel / multichannel management:
Method |
Description |
result = DL.OpenSideChannel( newSettings [, channelNo] [, rxChannelTag]) |
Open a side communication channel using the communication channel settings from newSettings.
channelNo = 3 (default) or 4-10
rxChannelTag = "Channel3" (default): <Channel3>... data received on this side channel... </Channel3> rxChannelTag = "norx": rxChannelTag = "" (empty string):
result = True: Successfully opened the channel. result = False: Channel could not be opened, e.g. settings invalid or COM port not available. |
DL.CloseSideChannel [channelNo] |
Closes the side channel. |
Remarks
The side channels depend on the main connection status and vice versa:
•OpenSideChannel will automatically execute a StartCommunication, if required.
•CloseSideChannel only closes the specified side channel. Other communication channels continue data transfer.
•StopCommunication closes the main communication channels and any open side channels.
See also StartCommunication / StopCommunication.
Example
DL.SetChannelSettings "LOCALHOST:10001"
DL.StartCommunication
DL.OpenSideChannel "SERVER:10001"
DL.ResetReceiveCounter
DL.SendSequence "", "Test", "A"
DL.Pause 1000
DL.AddComment "Stop the Channel3. This should cause a TCP client connection error..."
DL.CloseSideChannel
DL.Pause 4000
' close all channels
DL.StopCommunication
The communication window output could look like this:
02.10.2019 12:44:23.622 [TX] - Test
02.10.2019 12:44:23.634 [RX] - <Channel3>Test</Channel3> [Channel3]
Stop the Channel3. This should cause a TCP client connection error...
02.10.2019 12:44:24.179 DOCKLIGHT reports: Error on channel LOCALHOST:10001:
TCP/IP connection closed by the remote computer