bitlet icon indicating copy to clipboard operation
bitlet copied to clipboard

Downloads

Open Rimander opened this issue 9 years ago • 3 comments

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();

Rimander avatar Jun 23 '15 19:06 Rimander

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!

abahgat avatar Jun 24 '15 01:06 abahgat

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.

Rimander avatar Jun 25 '15 08:06 Rimander

hi what do i do to download

DOCTARL avatar Dec 28 '16 13:12 DOCTARL