mpetazzoni / ttorrent

BitTorrent Java library with tracker and download client
http://mpetazzoni.github.com/ttorrent/
Apache License 2.0
1.39k stars 502 forks source link

How to create a torrent? #244

Closed Peterppan closed 5 years ago

Peterppan commented 5 years ago

how to cteate a .torrent file from the client?

Dead-off commented 5 years ago

use MetadataBuilder class simple example:

byte[] torrentMetadataBytes = new MetadataBuilder()
            .addDataSource(new ByteArrayInputStream(new byte[]{1,2,3}), "singleFile.txt", true)
            .setTracker("http://localhost:12346")
            .buildBinary();

For adding local files you can use addFile method instead of addDataSource

Peterppan commented 5 years ago

Thank you very much for your answer,but i have confused about the other client how to download the shared files. When i create the .torrent file with the MetadataBuilder class, and which client be the seeder frist?

Peterppan commented 5 years ago

I create a .torrent file and use client download it,but the tracker allways get the request event NONE. how can i fix it?

2019-07-22 14:18:18,026 [Dispatcher-4 ] WARN : RequestEvent event: NONE 2019-07-22 14:18:18,026 [Dispatcher-4 ] WARN : peer!!

Dead-off commented 5 years ago

Looks like you created a separate issue for this question. Ask me there