Android Question UDPSocket issues

techknight

Well-Known Member
Licensed User
Longtime User
I am having a UDPSocket issue. Its very odd.....

I found an example of using it in the main library.

Well the issue I have is it wont receive any UDP packets from anything on my local network. Everything is on my network, and I have the proper ports passed through the firewall, etc...

On one condition.. If I start the app and Send something first, it works fine, it will receive from the device I sent to, but no other device.

But If I just idle, and dont send anything, it wont recieve anything. Any ideas? Sometimes its buggy. For example, if i change UDP tools it wont receive anything regardless if i send or not. I tried UDP Tool 3.0 and it wont receive anything from it.

So i tried Easy TCP/IP Tool from MCS electronics and it will receive from it. but only if i send to it first...

So I tried another scenario, I ran the example code on both my phone and my tablet at the same time. Only 1 will receive the text. If i restart the app on the other device the 1st device looses the ability to receive the UDP for some strange reason. I tried sending it to my broadcast address. 192.168.0.255. All my PCs get the UDP packet, but my tablet or my phone will NOT unless I send first. and ONLY that device will receive if if I sent it from that device.

what is going on?
 

techknight

Well-Known Member
Licensed User
Longtime User
Nevermind. I figured it out.

The problem was the example that was in the UDPSocket wiki confused me.

The port and buffer size was switched for the UDPSocket.initialize on my part. I swapped those around and problem fixed. thank god.
 
Upvote 0
Top