how can torrent be p2p and without needing to open ports? [closed]

I've been using torrent for years now and I am planning to write a simple golang program to manage p2p connections...

But since I see everywhere that for a p2p program to work, one must specify an open port, a question came to my mind... how is it possible that utorrent works without the need for opening a port on the router? (yea I know that people say that opening one just for utorrent might improve the speed, but for me it always worked without this trick)

thanks, I'm really puzzled right now...


Solution 1:

It works by using a reverse connection, your client connects to an outside server, and this connection is then used for both incoming and outcoming traffic. If everyone using P2P would be behind a blocked port it woulnd't work, so it assumes that some clients/servers have their ports open.

This is a common solution for games and other clients that needs to send data in any direction, and there are solutions such as uPNP so that the client can ask the router to open a port and do a port-mapping when necessary as well.