hangs after it opens the torrent
Opened this issue ยท 8 comments
Hi Allen, i wanted to use allen-torrent as a quick way to download torrents after i have searched a few torrent APIs as part of a school project, however there is no documentation (granted this, i assume was a tut).
When i try:
node index.js path/to/file-torrent
It just hangs, no information before the hang either. I am quite sure i added all the npm dependencies. Why does it just hang?
I am not really sure at all but when doing this
socket.on('message', response => {
if (respType(response) === 'connect') {
console.log("Connect in socket");
// 2. receive and parse connect response
const connResp = parseConnResp(response);
// 3. send announce request
const announceReq = buildAnnounceReq(connResp.connectionId, torrent);
udpSend(socket, announceReq, url);
} else if (respType(response) === 'announce') {
// 4. parse announce response
const announceResp = parseAnnounceResp(response);
// 5. pass peers to callback
callback(announceResp.peers);
}
});
I can not see the console.log
EDIT. The problem was that the tracker is dead. I need to check the different trackers in the torrent file and find one or multiple that are working
This was also happening by me. The problem was that torrent.announce was a http connection and not a udp connection. Most popular torrents these day have an "announce-list", to solve my problem i selected (if available) a udp connection from the "announce-list".
Mine is still hanging indefinitely...
I got it all exactly like his code and still not responding (tested my .torrent and it works on BitTorrent).
I also tried cloning his repo and trying to download by the clone, and it hangs as well.
Is someone out here who knows what is happening maybe?
Yeah mine is also hanging, no "message" event is ever fired on the socket. I can confirm the socket is listening, but there is never an error or message. My torrent is udp, and I have been able to download it using another client.
As gewooneils noted though that using the announce list to attempt to connect to another tracker until I find one that responds worked for me.
@ButsAndCats could you please explain further how you solved this problem
@karanmottan , there is a tracker list property that is an array of trackers that you can attempt to if the first tracker fails. I updated my code so that it iterates through each tracker until it finds one that connects.
Can anyone provide a torrent file link for which this client works.