12-03-2009 08:29 AM
I am facing problem while communication between two mobile clients using DatagramConnection. To identify IP address of mobile client, we send one HTTP request to server, then server identifies IP addresses of mobile clients. So to communicate between mobile clients c1 and c2, c1 takes IP address from server and send packet through DatagramConnection. We hardcoded port number to communicate. We open server connection on c1 and client connection on c2, c2 can successfully sent the datagram packet without any exception, but c1 did not receive the packet.
We donot want to use the wifi connection.
I am unable to find where is the problem. If someone suggest any solution how to do this, this is very much helpful for me.
Thanks in advance.
12-03-2009 09:01 AM
I don't think this is solvable.
Does it have to be a datagram? How about using the BBM protocol?
See the TicTacToe demo that ships with the JDE for an example of setting up device-to-device communications using BBM.
12-03-2009 09:04 AM
if both devices have a public ip (wifi) bbm could be used to control the connection.
12-03-2009 09:13 AM
Thanks for your response.
We need to send the voice data, so is it ok to send voice data through BBM?
Can you please tell me any other way to do this?
12-03-2009 09:18 AM
bbm would be used for the control channel only
12-03-2009 09:27 AM
Thanks for your quick response.
One last question, if you could please suggest , is any other way to transfer voice data between two mobile clients?
12-03-2009 10:08 AM - edited 12-03-2009 10:10 AM
I suggest you read about Network Address Translation (NAT). In many cases, mobile clients are inside a private LAN inside the carrier network. The LAN has NATed Internet access. As mentioned earlier in this thread, your solution will work if your mobile clients aren't NATed (i.e., assigned a public IP address), but they might still be behind a firewall (so, the last paragraph from this post will still apply).
You solution won't work in many cases because of the following.
Firstly, the source IP of the HTTP over TCP connection as seen by your server will not necessarily be the same as the source IP of NATed UDP datagrams your mobile client will be sending. NAT can allocate IP address + port pairs from a large pool spanning a large number of IP addresses. So, a TCP connection can get one NATed IP address, and a UDP session might get another.
Secondly, some NATs/firewalls (not all!) will only accept incoming UDP datagrams from the original destination (the destination of the first UDP packet that caused the NAT/firewall rule to be created). So, even if you send a UDP datagram to your server to record the NATed IP address + port pair, that IP address + port pair will only accept UDP datagrams from your server, and will not accept UDP datagrams from another mobile client.
12-04-2009 02:27 AM
I'm also facing the same problem while trying to connect two BlackBerry Device Peer-to-Peer using UDP connection. We've a HTTP server and all the clients sends the first request to it. From this request the server is resolving the IP address and the port number of the device and maintain the list of the IP addresses and the port numbers. This list is coming as response to the device. Now using this IP address and the port number while we're trying to make a UDP connection, the connectin is establishing sucessfully (I conclude this, as I did not got any exception), but no packet is received at the other end i.e. other device.
Any kind of help on this with some sample code will be of great help.
Thanks in advance.
12-04-2009 05:39 AM
Thanks a lot klyubin for your suggession.
We are working on NAT. We are using public stun server to get the NAT type of the carrier. Airtel is our service provider, and we got response from server as " Node has open access to the Internet (or, at least the node is behind a full-cone NAT without translation)".
can you please tell me, Peer to peer communication is possible on Airtel?