12-04-2009 09:08 AM
I got IOException while sending the datagram packet from one mobile device to another mobile device. I have tried both the ways ( "datagram://" and "udp://" )of making UDPDatagramconnection but in both the cases IOException is coming.
Could anyone please help me out on this ?
12-04-2009 09:17 AM
try to send and receive from different ports.
12-04-2009 09:25 AM
Thanks a lot Simon for response
Yes I am trying to send from one device and receiving from another device so receiver device is opened in server mode and sender device is opened as an client. But getting exception while trying to send the datagram and reveiver is till waiting for the datagram.
Here is the code -
UDPDatagramConnection UdpInstance = (UDPDatagramConnection)Connector.open(serverUrl);
Datagram datagram = UdpInstance.newDatagram(200);
String testData = "HelloClient 1";
datagram.write(testData.getBytes()); // written the byte array
Could you please tell me where I am doing wrong ?
12-04-2009 09:30 AM
one more thing to say. Is there any problem with IP address and port number, if the IP address or port number is wrong so will I get any exception in creation of the instance ? we are taking the IP address and port number of the device from one public STUN server.
12-05-2009 12:31 AM
I am also facing the same problem as above post, I am getting exception while sending the UDP datagram packet from one device to another device. Because in the same way I am able to send datagram to server and can receive the datagram from server successfully but getting exception when I am sending data from one mobile device to another mobile device. For knowing the IP address and the port number of other device I am also using one public STUN server that is "stun.xten.com". So is there any problem with IP address or port number. Would I get exception at the time of instance creation if IP or port is wrong ?
Can anyone please help me out on this ?
12-08-2009 04:13 AM
Keep in mind that prior to v4.6.0 handheld software, UDP sending works only on v220.127.116.11+. On v18.104.22.168- you get an IOException with null or empty detail message.
Another reason why you might be getting an IOException is that, according to javadocs, you're supposed to listen for incoming datagrams even if you aren't expecting any reply.
02-17-2011 04:44 AM
I have achieved this and developed a voice communication application with different codecs. Feel free to reach out to me if you need any help, thanks.