4

I'm trying to set up a connection over TCP between two devices on different networks in node.

I've been reading all over that to connect over TCP two devices I either need to set up port forwarding on the router, ore use ICE connections (good summary here).

For what I know, these limitations make total sense.

So what I don't get is, how can WebTorrent work without either port forwarding or ICE connections. The project Readme explains that In node.js, this module is a simple torrent client, using TCP and UDP.

I've looked at the code but honestly I did not get how it's done, anyone knows how torrent clients are able to seed and download data from other peers over TCP without port forwarding/middleware?

don
  • 4,113
  • 13
  • 45
  • 70
  • Without a tracker or DHT there's no way how torrent clients with closed ports could connect each other. Some "middleware" is required anyway. – montonero Jan 29 '19 at 08:07
  • For what I managed to understand, trackers (and DHT) serve the purpose of telling peers who's online and seeding/leeching, and therefore providing info on where each peer is so that other peers can connect to them. Like a server exchanging ICE info would do in WebRTC. If that is correct, are you telling me that trackers also tunnel traffic to each peer? – don Jan 29 '19 at 08:20
  • No, trackers do not tunnel traffic but they give information about where peers are (as you've correctly mentioned). I wasn't quite correct with my previous comment: if there are only clients with closed ports then they can't exchange any data, at least one of them should be with an open port. This client will be a "tunnel" for all other clients. – montonero Jan 29 '19 at 08:47
  • So that means that if I connect to a torrent network from my home pc, which is behind a router, and then I want to download a file stored on such PC (which is the only seeder) from another PC, behind another router, the connection between the two would actually be tunneled through another peer on the network? – don Jan 29 '19 at 09:43
  • Yes, you're correct. Actually this peer will download the file from your home PC and then seed it to your other PC. – montonero Jan 29 '19 at 09:57

0 Answers0