DirectSend

<< Click to Display Table of Contents >>

Navigation:  Reference (Scripting) > Side Channels - Using Multiple Data Connections >

DirectSend

The DirectSend method is an alternative to SendSequence for specific applications. The syntax is similar to SendSequence syntax 2 and is used for the following purposes:

Sending data on side channels - secondary data connections opened using OpenSideChannel.

Transmitting / injecting additional data, bypassing the OnSend data queue and without adding communication window output. See Remarks and Example 2 below for a practical example.

 

Syntax

 

result = DL.DirectSend channelNo, customSequence [, representation ]

 

The DirectSend method syntax has these parts:

 

Part

Description

channelNo

channelNo = 3 - 10: Send data on a side channel (see OpenSideChannel).

channelNo = 1: Send on Docklight Channel 1 (Send/Receive or Monitoring Mode)

channelNo = 2: Send on Docklight Channel 2 (Monitoring Mode only)

customSequence

Required. String containing the sequence to send. The sequence is passed in ASCII representation by default. For HEX, Decimal or Binary sequence data, use the optional representation argument described below.

representation

Optional. String value to define the format for customSequence.  "A" = ASCII (default), "H" = HEX, "D" = Decimal or "B" = Binary.

 

 

Remarks

 

result is true, if channelNo is valid and the data could be transmitted.

 

The main application for DirectSend is in combination with OpenSideChannel. In addition, DirectSend can be useful when you are monitoring a data connection, and you need to inject additional data into the data stream between the two devices. You can effectively change the "passive monitoring" approach in Docklight into a "active monitoring" where Docklight can create e.g. additional fault conditions that do not appear in the original communication.

 

NOTE: DirectSend does not generate any communication window output, and does not use the OnSend data queue. It just transmits your text or binary data "as is".

 

Example 1

 

' Precondition: Docklight Communication Mode = Send/Receive

DL.StopCommunication

' Use a UDP loopback for Channel 1

DL.SetChannelSettings "UDP:LOCALHOST:10001", 1

DL.StartCommunication

DL.OpenSideChannel "UDP:LOCALHOST:10002"

DL.DirectSend 1, "TX Data on Channel 1" + vbCrLf

DL.DirectSend 3, "TX Data on side channel" + vbCrLf

' and wait for the reactions

DL.Pause 100

 

The communication window output could look like this:

 

02.10.2019 11:51:26.749 [RX] - TX Data on Channel 1<CR><LF>

<Channel3>TX Data on side channel<CR><LF>

</Channel3>

 

NOTE: The data only appears on the RX data display. No TX communication output is generated.

 

Example 2

 

' Precondition: Docklight Communication Mode = Monitoring

DL.StopCommunication

DL.SetChannelSettings "UDP:LOCALHOST:10001", 1

DL.SetChannelSettings "UDP:LOCALHOST:10002", 2

DL.StartCommunication

DL.DirectSend 2, "Bounce"

' and let this go on for a while

DL.Pause 1000

 

The communication window output could look like this:

 

02.10.2019 12:03:08.840 [UDP:LOCALHOST:10002] - Bounce

02.10.2019 12:03:08.840 [UDP:LOCALHOST:10001] - Bounce

02.10.2019 12:03:08.841 [UDP:LOCALHOST:10002] - Bounce

02.10.2019 12:03:08.848 [UDP:LOCALHOST:10001] - Bounce

02.10.2019 12:03:08.851 [UDP:LOCALHOST:10002] - Bounce

02.10.2019 12:03:08.864 [UDP:LOCALHOST:10001] - Bounce

 

NOTE: The data is repeatedly reflected between Channel 1 and Channel 2, because we use UDP loopbacks on both ends, and Docklight Monitoring Mode uses Data Forwarding by default.