-1

I am attempting to make a chat application on the .NET framework that will be able to communicate over the internet and not just LAN. I would like it to be P2P as to not require a central server. I don't mind which protocol it uses (UDP, TCP, etc) so long as I can send messages to almost any given IP.

All I would like to know is how to send data to another IP I know of, nothing else. I've searched around but the code is too complicated for me. (For example I've looked at the source code for torrent clients).

Help will be appreciated a lot thanks.

P.S.: I've heard about a method called UDP hole-punching if that sparks any plugs.

John Smith
  • 21
  • 2
  • 1
    People PLEASE, how about instead anonymous downvoting provide at least one word or perhaps if it would not hurt too much a sentence or link, any help other than -1, -2, yeah, clicking is so fast, but is discouraging... – ipavlu Nov 14 '15 at 02:46

2 Answers2

1

There is a small issue with your plan.

The server-centric approach does not serve only as a slow middle man, but also as a central point with known address to connect to, an anchor in the sea to attach to and clients connect to the static IP/name of the server.

Usually, users do not care what is their IP address on the internet...

So at the minimum, the server is good to get list of clients. Nowadays you can use some services from Microsoft or Google or other.

Now rest of the P2P communication of clients between NAT comes with more learning: TCP_hole_punching

I would suggest reading all that stuff then look for some code or library that does it.

Here is older topic similar to yours looking for the hole punching library: tcp hole punching library

Community
  • 1
  • 1
ipavlu
  • 1,617
  • 14
  • 24
  • How come it is downvoted? It is answer to the topic. How about to spit out a reason. Once again, how about helping first, then anonymously downvoting second, or rather fifth or tenth? :) – ipavlu Nov 14 '15 at 19:39
0

I have answered similar kind of things here Peer-to-Peer application using java, let me know if it helps or if you have any specific question about this. Basically you need NAT traversal, so you would find many different ways to achieve this based on your need. Even you can achieve this simply configuring your router by enabling UPnP.

Community
  • 1
  • 1