I'm trying to broadcast a UDP package (datagram) but can't get it to work on the device (Asha 310). Here is my code:
If I use concrete address (e.g. 192.168.0.2) the packet is send without problems. If I use 255.255.255.255, conn.send() finishes without exception but nothing gets send on the network (checked with Wireshark). If the address is using the correct format to broadcast just in this network segment as above (192.168.0.255), conn.send() throws "Failed to send datagram" exception.
UDPDatagramConnection conn = (UDPDatagramConnection) Connector.open("datagram://");
System.out.println("Local address " + conn.getLocalAddress() + ":" + conn.getLocalPort());
Datagram dg = conn.newDatagram(pPacket.length);
dg.setData(pPacket, 0, pPacket.length);
In the simulator 255.255.255.255 still does not work but 192.168.0.255 works just fine. However on the device nothing works (except sending to a concrete, non-broadcast address). Any clues? Is the UDP broadcast possible at all on Asha devices?
Thanks in advance.