ttorrent
ttorrent copied to clipboard
Cannot connect to peers behind NAT
Hi!
I've tried to use your library with different trackers and different torrent files but it doesn't work ,this is my logger output:
2012-11-12 23:26:06,023 [bt-announce(..616566) ] INFO : Announcing STARTED to tracker with 0U/0D/6153490L bytes... 2012-11-12 23:26:06,043 [bt-announce(..616566) ] INFO : Setting announce interval to 1755s per tracker request. 2012-11-12 23:26:06,043 [bt-announce(..616566) ] INFO : Got 2 peer(s) in tracker response, initiating connections... 2012-11-12 23:26:06,052 [bt-connect-1 ] INFO : Connecting to peer://10.199.17.6:6882/? [Ci|Ci]... 2012-11-12 23:26:06,052 [bt-connect-2 ] INFO : Connecting to peer://10.199.17.6:51413/? [Ci|Ci]... 2012-11-12 23:26:06,054 [bt-connect-2 ] INFO : Could not connect to peer://10.199.17.6:51413/? [Ci|Ci]: Connection refused. 2012-11-12 23:26:06,054 [bt-connect-1 ] INFO : Could not connect to peer://10.199.17.6:6882/? [Ci|Ci]: Connection refused. 2012-11-12 23:26:06,789 [bt-client(..616566) ] INFO : SHARING 0/376 pieces (0.00%) [0/0] with 0/0 peers at 0.00/0.00 kB/s. 2012-11-12 23:26:09,790 [bt-client(..616566) ] INFO : SHARING 0/376 pieces (0.00%) [0/0] with 0/0 peers at 0.00/0.00 kB/s. 2012-11-12 23:26:12,792 [bt-client(..616566) ] INFO : SHARING 0/376 pieces (0.00%) [0/0] with 0/0 peers at 0.00/0.00 kB/s. 2012-11-12 23:26:15,793 [bt-client(..616566) ] INFO : SHARING 0/376 pieces (0.00%) [0/0] with 0/0 peers at 0.00/0.00 kB/s. 2012-11-12 23:26:18,795 [bt-client(..616566) ] INFO : SHARING 0/376 pieces (0.00%) [0/0] with 0/0 peers at 0.00/0.00 kB/s.
And it prints this many many times What's happening?Connections are always refused.I have downloaded files with number of peers in range from 50 to 150,but it's the same. Thank you.
Hi Dmitry,
It looks like communicating with the track works as you are getting peers back. But you don't seem to be able to connect with the peers (see the two Connection refused
messages). Is there NAT involved in your setup?
Thanks, /Max
Hi Dimitry, seems to me Maxime has the solution. The connection for the peers are blocked, perhaps a connection through the ports 6882 and 51413 is denied (firewall?).
2012/11/12 Maxime Petazzoni [email protected]
Hi Dmitry,
It looks like communicating with the track works as you are getting peers back. But you don't seem to be able to connect with the peers (see the two Connection refused messages). Is there NAT involved in your setup?
Thanks, /Max
— Reply to this email directly or view it on GitHubhttps://github.com/turn/ttorrent/issues/25#issuecomment-10301140.
Thanks for your answers!I understand that problem is in using router,so NAT is involved and as I understand your app doesn't support UPnP?
That's correct. ttorrent as a library, for now at least, doesn't manage NAT at all. It's fairly complex to get right and so far I haven't had the time to look into it.
There's a library out there called Cling that provides a library for UPNP. I've been using it in my own application and it seems to be working well. Definitely worth taking a look at.
I connect to the internet using a router, so I am in a NAT. I downloaded the highest seeder torrent from YIFY (10,000 seeders) and gave it to ttorrent client for download. I was getting the same error/messages as the original poster. However, the pieces started downloading slowly but surely. After some one hour, I have had some 50 out of 450 pieces downloaded. How do you explain this behavior?
Some of the seeders may be directly connected to the Internet, so you can connect to them even you are behind an NAT. (though these connections must be initiated by you since they cannot see you) Once you tried to connect to them, the broker of the seed and the clients of seeders can handle the NAT issue for you.