Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloads #13

Open
Rimander opened this issue Jun 23, 2015 · 3 comments
Open

Downloads #13

Rimander opened this issue Jun 23, 2015 · 3 comments

Comments

@Rimander
Copy link

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();
@abahgat
Copy link
Member

abahgat commented Jun 24, 2015

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!

@Rimander
Copy link
Author

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.

@DOCTARL
Copy link

DOCTARL commented Dec 28, 2016

hi what do i do to download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants