UDP Receive performance difference

arparker

Member
Licensed User
Longtime User
I am currently running the same UDP receiver code on two devices; Samsung Galaxy S WiFi 5.0 and ASUS Transformer Prime. I have an XP box unicasting 8k UDP packet at 20 packets/sec. Both devices are connected to my wireless network at 54Mb but ASUS is not able to keep up with the transmission rate. The following code is what's being executed with a packet is received:

B4X:
Sub UDP_PacketArrived (Packet As UDPPacket)
   Dim moddatasize As Int
   
   UDPcounter = UDPcounter + 1
   SendingHostIP = Packet.Host
'   Log(SendingHostIP)
   datasize = ((Packet.Length/4)-3)
   moddatasize = datasize/10
   If (UDPcounter Mod 20)==0 Then
      Log(UDPcounter&"  "&Packet.Length)
   End If
End Sub

No other code is running other than this interrupt. Once I stop the transmitting the ASUS continues to process packets as if I'm still transmitting to drain the internal receive buffer. Any thoughts as to why the lowly Samsung can handle this transmission but the ASUS cannot?
 

arparker

Member
Licensed User
Longtime User
I was able to comment out the following line and the ASUS was able to sustain the transmission rate.
B4X:
   SendingHostIP = Packet.Host

Don't know why handling strings within the PacketArrived interrupt caused poor performance on the ASUS and not the Samsung.
 
Upvote 0

electro179

Active Member
Licensed User
Longtime User
heavy operation

do you have a solution to get the Ip of Host because if I do packet.host the time operation = 3 sec .
I'd like to get directly the ip
 
Upvote 0

electro179

Active Member
Licensed User
Longtime User
thank you but I have an error :
LastException java.lang.NoSuchFieldException: packet at line r.Target = r.GetField("packet")

I use the reflection version 2.10
 
Last edited:
Upvote 0
Top