0

I need to make some general way for my own peer-to-peer UDP or TCP communication between my own clients over internet, without creating own server.

I cannot just use XMPP for the communication because file transmit are necessary.

Do I understand the possible sequence of actions correctly?

  • Connect to some (or any?) XMPP server, using prepared existing XMPP account
  • Search for another my own client connected to XMPP and connect to it.
  • Resolve an unique public global internet (IP?) address or ID for each client (how?)
  • Exchange these addresses between clients
  • Make direct connection possible by some actions with clients' NATs
  • Connect clients directly p2p to each other using received unique addresses
  • Disconnect from XMPP server
  • Communicate via my own p2p connection

If the sequence is correctly, what specific actions do I need to do to resolve unique addresses, and to make an UDP or TCP connection then? How that can be done on c++?


Edit.

I've found nice answer here: Programming P2P application

Vladimir Bershov
  • 2,701
  • 2
  • 21
  • 51
  • 1
    The technology you are looking for is a [STUN server](https://en.wikipedia.org/wiki/STUN) – Botje Dec 18 '19 at 09:07
  • you could look at https://pjsip.org/ they have lots of code for handling NAT traversal. getting this working through corporate networks can be very awkward as they can be very hostile about this sort of behaviour – Sam Mason Dec 20 '19 at 17:14
  • @SamMason sounds as good library, but web documentation is very strange. Cannot find usual getting started. – Vladimir Bershov Dec 20 '19 at 19:00
  • @VladimirBershov does https://www.pjsip.org/pjnath/docs/html/ice_demo_sample.htm help? – Sam Mason Dec 20 '19 at 19:17
  • @SamMason thanks, but I won't use pjsip. – Vladimir Bershov Dec 20 '19 at 19:57
  • @VladimirBershov the pointer to pjsip was more that it has to deal with NAT traversal, hence some of the documentation should be useful to identify existing solutions to the problems you're likely to come up against – Sam Mason Dec 20 '19 at 20:13

1 Answers1

4

Your situation is close to WebRTC: peers need a way to 1) discover each other ("signaling"), 2) set up a direct connection through NAT if needed. (STUN/TURN)

See this WebRTC infrastructure overview for a start, and ask more specific follow-up questions later.

Botje
  • 26,269
  • 3
  • 31
  • 41