Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
New Developer
Posts: 122
Registered: ‎09-04-2008
My Device: Storm II Model 9550
My Carrier: Developer

Peer to Peer communication.

Hello All,

 

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.

 

-Shekhar.

New Developer
Posts: 122
Registered: ‎09-04-2008
My Device: Storm II Model 9550
My Carrier: Developer

Re: Peer to Peer communication.

Any help please.

 

-Shekhar.

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Peer to Peer communication.

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.

 

Developer
Posts: 16,841
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Peer to Peer communication.

if both devices have a public ip (wifi) bbm could be used to control the connection.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 122
Registered: ‎09-04-2008
My Device: Storm II Model 9550
My Carrier: Developer

Re: Peer to Peer communication.

 

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?

 

-Shekhar.

Developer
Posts: 16,841
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Peer to Peer communication.

bbm would be used for the control channel only

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 122
Registered: ‎09-04-2008
My Device: Storm II Model 9550
My Carrier: Developer

Re: Peer to Peer communication.

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?

 

-Shekhar.

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Peer to Peer communication.

[ Edited ]

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.

New Developer
Posts: 9
Registered: ‎09-11-2009
My Device: BlackBerry 9630
My Carrier: Developer

Re: Peer to Peer communication.

Hi All,

 

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.

 

Regards,

Anindya Sen.

New Developer
Posts: 122
Registered: ‎09-04-2008
My Device: Storm II Model 9550
My Carrier: Developer

Re: Peer to Peer communication.

Thanks a lot 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?

-Shekhar.