I am writing network application for Blackberry .This code is correct at simulator but not working at device. When i run my application on simulator, my server recieves the msg but when i run it on handheld, i get Exception (not IOException) that "null".
try { byte[] b = msg.getBytes(); dc = (UDPDatagramConnection)Connector.open("datagram://"+getHIP()+":" + getHPort()); Datagram dobject = dc.newDatagram(b, b.length); dc.send(dobject); System.out.println("Addr:" + dobject.getAddress()); System.out.println("Well Done!"); }
catch (IOException e) { System.out.println(e.getMessage()); } catch (Exception e)
{ System.out.println(e.getMessage()); }
finally { if (dc != null)
{
try { dc.close(); }
catch (Exception f) { System.out.println("Failed to close Connector: " + f); } }
}