UDP IP setup
Posted
#1
(In Topic #1171)
Regular

I upgraded last night from Gambas 3.14.3 to 3.18.4 and found that the UDP receiver as part of gb.net is no longer working, here is the code in question:
Public Sub UDPUser_Read()
Dim $Data As String
Read #UDPUser, $Data, Lof(UDPUser)
$VidData = $Data
' Print $Data
End
With testing it with print, I could see that data was coming in with version 3.14.3 and on 3.18.4 there was nothing, has there been format change in how this works in the later version of Gambas?
Testing the send part still works well, but it seems that something is going on with the receiver side.
Posted
Guru

It's hard to tell without seeing your code or a test app.
Does the UDPUser_Read() event trigger?
is the socket opened like this…
UDPUser = New UdpSocket As "UDPUser"
and opened in the same class as the UDPUser_Read() sub
Posted
Regular

"Does the UDPUser_Read() event trigger?" yes
I am getting date come out now, the issue seem to be also with the String processing for example at the next step:
$TXDataRY = Left$($VidData, 2880)
$TXDataBY = Mid$($VidData, 2881, 2880)
'$TXDataBY = Mid$("test test", 6, 4)
Print "-" & $TXDataBY & "+"
If I print out "$TXDataBY = Mid$($VidData, 2881, 2880) " I get nothing between the "-+", but if do the same with "$TXDataBY = Mid$("test test", 6, 4)" I get "-test+" printed out. Left$ and Mid$ seem to have issues with larger numbers, in the later version.
I am sending video information between two computers with UDP and therefore I getting very large strings to work with.
Any ideas?
Other Topic.
Posted
Guru

have you checked $VidData.Len > 2880
Or should that be String.Len($VidData) as with non-UTF8 strings like image data it will make a difference
Posted
Regular

I get 18152 more than I require to work with using ascii 8bit, no issues on the older version with the same code.
Posted
Regular

Dim tmp as String
$TXDataRY = Left$($VidData, 2880)
tmp = Left$($VidData,-2880)
$TXDataBY=Left$(tmp,2880)
Print "-" & $TXDataBY & "+"
b
Posted
Regular

-+
Years working with strings and they seem simple, but from this test Left$ and Mid$ have the same issue.
1 guest and 0 members have just viewed this.


