How do I transfer binary data with your controls?

IPWorks provides byte-array properties for all data sending properties such as DataToSend, EOL etc. The names of these byte array properties are derived from the base property by appending a 'B' such as DataToSendB, EOLB etc.

An example of use would be:

Dim A(0:5) as Byte 'remember to dim explicitly "0 to len-1"
For i=0 to 5
	a(i) = chr(127+i)
next i
IPPort1.DataToSendB = A

A similar problem arises when receiving data. In that case there's ONLY ONE byte-array property called DataInB property. It's the same name across all controls. The property is valid only inside the event. An example of use would be the following:

Private Sub IPDaemon1_DataIn(ConnectionId As Integer, Text As String, 
EOL As Boolean)

'the Text parameter contains the received data which, sometimes,
'may have been converted incorrectly -- especially in Unicode
environments.
'the DataInB property has always the correct bytes.

Dim A() As Variant

'get the array's value when you first enter the event. -- VERY Important
with IPDaemon
A = IPDaemon1.DataInTextB

'only now you may manipulate it ...

Debug.Print Text

For I = LBound(A) To UBound(A)
  Debug.Print A(I)
Next I

End Sub

We appreciate your feedback.  If you have any questions, comments, or suggestions about this article please contact our support team at kb@nsoftware.com.