views:

50

answers:

2

Hi All,

I am trying to implement a peer to peer communication ..

I use sockets for communication between them. I want to know if there are any ways i can use the same sort of communication when the two peers are behind two private Networks (They dont know each others public ip address.) I can think of a shared buffer in a well known location as a means of communication. But is there some other way to get this done?

+1  A: 

You may also have to consider the case where two peers don't even have public IP addresses, in which case you could use STUN techniques to avoid the need for a central server. STUN has been used effectively in products such as Skype (I think), but it remains quite a black art at this stage.

For a central approach, consider XMPP, of which ejabberd is a very popular implementation. Various other messaging protocols exist as well, such as the emerging AMPQ standard.

These technologies are likely to be more robust and scalable than a home-grown socket-based protocol.

Marcelo Cantos
A: 

STUN and TURN are the common ways to achieve this as already posted and are standards based approaches. However, I have seen a really interesting approach to doing this using icmp messages recently. It's called pwnat, and available here

Kevin Nisbet