This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52840 UDP Socket Android Help!

Chip: nrf52840

Platform: Android

MacOS Dev

There is pretty much no error logs but it can't actually send anything over mesh network on udp. Seems to receive without any issues but on send it doesn't go.

try {
sock = new DatagramSocket(null);
udpPacket = new DatagramPacket(data.getBytes(), data.length(), InetAddress.getByName(deviceAddr), portServer);

```
sock.send(udpPacket);
Log.e(TAG, "Connection send: " + data);

if (!sock.isClosed()) {
sock.close();
Log.e(TAG, "Socket Closed");
}
} catch (SocketException e) {
Log.e(TAG, "Socket Issue: " + e.getMessage());
} catch (UnknownHostException e) {
Log.e(TAG, "Host Issue: " + e.getMessage());
} catch (IOException e) {
Log.e(TAG, "IO Issue: " + e.getMessage());
}
```
thats the code for send over udp.

Here is the addr: fdde:ad00:beef:0:8142:58d9:a2a3:7377 port is 1212 and on receive there are no trouble.

Any thoughts?

  • Hi,

    What type of mesh network are you talking about? What is running on the nRF52840? How do the Android device interface with the nRF?

    Best regards,
    Jørgen

  • Hey we are talking about Thread Mesh and its running over 6Lowpan with Android. So the idea is to find the address over the network and send something to the device over the cli. It seems to be working when cli device points to cli device and when a cli device sends to the android solution but when the send happens its like there are no errors and it just doesn't work. Usually i am searching for a reason but i can't see one if the receive is working properly without no issue. When i try to send again on the socket that was receiving just to pass an answer backwards even that doesn't work.

  • Can you provide a sniffer trace of the traffic between the devices, and also a diagram of your infrastructure? 

    When you say Android, do you mean a phone or some other Android device (i.e. Android Things that I see you worked on in previous case)?

  • Hey, thats exactly i mean. Its an Android Things device. Its nothing too major changed the example you guys have with Nest for 6Lowpan with a TCP Socket which works good. But i decided to try to use it with UDP and doesn't seem to work at all. Its basically two device. The receiver and the transmitter. I have read quite a lot on the subject and nothing actually wrong either with the code. Either with the devices. I think Android doesn't support some protocol thats needs to be there.

1 2