Sethu
Sethu

Reputation: 566

Network communication across two private network

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?

Upvotes: 2

Views: 1054

Answers (3)

Rohit
Rohit

Reputation: 7161

Since both are in different private networks, both peers cannot communicate with each other. You need to have a public server in place, so that you can establish connection via that server. Refer resiprocate , Resiprocate for details

Upvotes: 0

Kevin Nisbet
Kevin Nisbet

Reputation: 2249

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

Upvotes: 0

Marcelo Cantos
Marcelo Cantos

Reputation: 185862

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.

Upvotes: 1

Related Questions