W&T 57630 Manual page 112

Web-io series 12+12 digital
Table of Contents

Advertisement

W&T
By invoking the next structure the Read Counter structure is written
to a string and then send to the Web-IO.
Private Sub ButtonCounterRead_Click()
'// Fill the structure ReadCounter
ReadCounter.send_sequence = 0
ReadCounter.rec_sequence = 0
ReadCounter.struct_type = &HB0
ReadCounter.length = 10
ReadCounter.counter_index = 11 '// Input-Counter 11
'// Sending of the individual bytes of the structure ReadCount
'// to the string Str_ReadCounter
'// always beginning with the Low byte of the individual INTEGER variables
'// followed by the High byte
'// or the higher value byte for LONG variables
Str_ReadCounter = Chr(ReadCounter.send_sequence And &HFF) _
+ Chr((ReadCounter.send_sequence And &HFF00) / &H100) _
+ Chr(ReadCounter.rec_sequence And &HFF) _
+ Chr((ReadCounter.rec_sequence And &HFF00) / &H100) _
+ Chr(ReadCounter.struct_type And &HFF) _
+ Chr((ReadCounter.struct_type And &HFF00) / &H100) _
+ Chr(ReadCounter.length And &HFF) _
+ Chr((ReadCounter.length And &HFF00) / &H100) _
+ Chr(ReadCounter.counter_index And &HFF) _
+ Chr((ReadCounter.counter_index And &HFF00) / &H100)
Winsock1.SendData (Str_ReadCounter)
End Sub
And finally the procedure that automatically ionvokes the
Winsock control element when data are received by the network.
The implementation here is exactly the reverse of that
described above: The data arrive as a string and are written back
to the Counter structure.
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
'// Read arriving data into the string Str_Counter
Winsock1.GetData Str_Counter
'// Read out the individual bytes, calculate the value (Low Byte, High Byte)
'// and save in the counter structure
Counter.send_sequence = Asc(Mid(Str_Counter, 1, 1)) _
112
TCP / UDP - Binary

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

57631

Table of Contents