bitlet
bitlet copied to clipboard
Downloads
I cant download multiple torrents.
Metafile metafile = new Metafile(new BufferedInputStream(new FileInputStream(torrentPath)));
// Create the torrent disk, this is the destination where the torrent file/s will be saved
TorrentDisk tdisk = new PlainFileSystemTorrentDisk(metafile, output);
tdisk.init();
IncomingPeerListener peerListener = new IncomingPeerListener(randInt(5555,7777));
peerListener.start();
Torrent torrent = new Torrent(metafile, tdisk, peerListener);
torrent.startDownload();
while (!torrent.isCompleted()) {
try {
Thread.sleep(500);
} catch(InterruptedException ie) {
break;
}
torrent.tick();
nombre = torrent.getMetafile().getName().trim();
ratio = torrent.getPeersManager().getActivePeersNumber();
size = (int) torrent.getMetafile().getLength();
long actual = torrent.getTorrentDisk().getCompleted();
progreso = (actual * 100/ size);
System.out.printf("Got %s peers, completed %d bytes \n",
torrent.getPeersManager().getActivePeersNumber(),
torrent.getTorrentDisk().getCompleted());
System.out.println(torrent.getMetafile().getLength());
}
torrent.interrupt();
peerListener.interrupt();
Hi, can you please tell us more about what's the behavior you were expecting and what exactly you see when you run the code above? Thanks!
Hi. Yes. I need download multiple torrents at the same time. I changed this "new IncomingPeerListener(randInt(5555,7777));" because i thought that the problem is instace 2 clients in the same port.
But if i try with 4 torrents, only catch 0, 1 or 2 peers/seeds.
/////////////////////// How I can download the torrent to a website with java? The downloaded file will not let me use your application but with utorrent.
hi what do i do to download