Archived

This forum has been archived. Please start a new discussion on GitHub.

How can I make a P2P application?

I had research the bidir example and glacier2callback example. But the example case is not the P2P network environment. I want to make a P2P chat program, the program instance connects to another program instance throught the server has the real ip! How can I do it. Somebody can give example code?:confused:

Comments

  • marc
    marc Florida
    Welcome to the forums! Please update your signature as explained in this post.
  • Thanks for marc, anxious for your help.
  • matthew
    matthew NL, Canada
    I'm not sure I understand your question.

    If the endpoint ports of your application are publically accessible then applications can connect directly to the application and exchange data. Since most of our networks these days are protected by routers/firewalls and live in private IP space (192.168.x for example) then this generally is not the case. In this case you have two choices:

    - Make the port publically accessible. This can be done either by hand (editing the routers port forwarding table), or your application can do this automatically using some router protocol (UPnP for example).

    - Make use of bi-directional connections and some central authority. This is what "low-id" ports do in emule. All data is forwarded by a central server. This solution can also get more creative by using another peer that is publically accessible to forward data.
  • I want the client sends data to another peer without getting across the server. So that it can cut down the server load.
  • marc
    marc Florida
    All you need for a client A that wants to send data to a client B is a proxy to an appropriate Ice object in client B. However, ususally firewalls will not allow you to send data directly from one client to another.