Hi WonderfulRemote, Thanks for your reply!
Is the symbol '/' in your connection string? I noticed in the <<BlackBerry JDE Development Guide>> said that:
Open a datagram connection on a non-GPRS network.
Specify the source port number, including the trailing slash mark.For example, the address for a CDMA network connection would be udp://121.0.0.0:2332;6343/.
And what's the version of your device?
Here is my code for datagram connection, I attach the debugger to device via usb cable, and the code throw out Exception when executing send(), print out "null". Get the same Exception when add '/' to the String host appending after the port.
Code:
try {
DatagramConnection udp_client;
Datagram dg_out;
host = "udp://192.168.1.101:5009;5010" + ";interface=wifi;deviceside=true";
udp_client = (DatagramConnection) Connector.open(host.trim());
byte[] data = {65,66,67,68};
int len = data.length;
dg_out = udp_client.newDatagram(data,data.length);
udp_client.send(dg_out);
udp_client.close();
}catch (Exception e) {
System.out.println("UDP Exception:"+e.getMessage());
}