I am using VB6 with the Winsock control.
I can connect to the PBX's IP address/port OK and it accepts my connection.
I can send the initial connection string to the PBX as follows:
Expand|Select|Wrap|Line Numbers
- Mtosend = Chr$(&H0) & Chr$(&H25) & Chr$(&H60) & Chr$(&H23) & Chr$(&H80) & Chr$(&H2) & Chr$(&H7) & Chr$(&H80) & Chr$(&HA1) & Chr$(&H7) & Chr$(&H6) & Chr$(&H5) & Chr$(&H2B) & Chr$(&HC) & Chr$(&H0) & Chr$(&H81) & Chr$(&H5A) & Chr$(&HBE) & Chr$(&H14) & Chr$(&H28) & Chr$(&H12) & Chr$(&H6) & Chr$(&H7) & Chr$(&H2B) & Chr$(&HC) & Chr$(&H0) & Chr$(&H82) & Chr$(&H1D) & Chr$(&H81) & Chr$(&H48) & Chr$(&HA0) & Chr$(&H7) & Chr$(&HA0) & Chr$(&H5) & Chr$(&H3) & Chr$(&H3) & Chr$(&H0) & Chr$(&H8) & Chr$(&H0)
- Winsock1.SendData Mtosend
If I use the following code to retrieve the 51 byte data into a byte array, I get 51 zero's - in Wireshark I can see that the data packet only started with 0 (null) but the rest looked like valid data.
Expand|Select|Wrap|Line Numbers
- Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
- Dim DL As String
- Dim DTS As String
- Dim byteData(256) As Byte
- Dim i As Integer
- DL = CStr(bytesTotal)
- DTS = ""
- Winsock1.GetData byteData(), vbArray + vbByte, Val(Trim(DL))
- For i = 0 To bytesTotal - 1
- DTS = DTS & " " & Right$(("00" & Hex$(byteData(i))), 2)
- Next
- SaveLog "TCP Rx: " & DTS & " (bytes=" & DL & ")"
- Exit Sub
Please help - how can I get the proper data?
What am I doing wrong?