How to send data over global internet like torrents do?

Viewed 312

I am developing a mobile app where I want to send data to other devices without servers over the global internet.

Suppose that there are 2 mobile devices with IP addresses X and Y that are on the global internet. They both know each other's addresses and want to communicate with each other without a remote server. They decided to use port A1 for that. If X will send data to Y on the port A1 will it be delivered without ISPs blocking it?

I am not that familiar with networking, only know some basics. In theory, it should deliver it without problems as long as IP's port is open and they are connected through some networks. The reason I am asking this is that I am interested in how do torrents send data to each other on the global internet without servers and static IPs, also I am not sure if there are any standard blocks that ISPs could put, for example, every ISP only allows ports from A1-A100. I know most of the rules might depend on ISP but for this example let's consider some typical normal ISP. Any explanation would be appreciated.

3 Answers

It's called Hole Punching, can be used for TCP or UDP. The concept is pretty simple actually:

  1. clients are giving their sockets information between intermediary server
  2. the server update the socket information (if there is a NAT or Proxy between client and server)
  3. server share the socket information to target client
  4. client connect on each through other socket information via peer-to-peer connection

Many of those are already in Github. Check it.

your question : is it possible to send data between 2 non-static IPs like 2 mobile phones on the global internet, preferably with some sources.

short answer : yes .

long answer : There are multiple options to achieve this

  1. WebRTC (Web Real-Time Communication) is a technology which enables Web applications and sites to capture and optionally stream audio and/or video media, as well as to exchange arbitrary data between browsers without requiring an intermediary.

now there is a need of server in the initial process where both peers will exchange data to connect to each other

2.IPFS - InterPlanetary File System : A peer-to-peer hypermedia protocol designed to make the web faster, safer, and more open.its a peer to peer file transfer protocol like torrent.

you can use the first option WebRTC, as it is easy to use in modern web-based applications and most browsers support WebRTC now a days

Related