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

Why does this client Program output the log ”not B-encoded?” #204

Open
t7a6 opened this issue Apr 19, 2017 · 1 comment
Open

Why does this client Program output the log ”not B-encoded?” #204

t7a6 opened this issue Apr 19, 2017 · 1 comment

Comments

@t7a6
Copy link

t7a6 commented Apr 19, 2017

Client Program

public static void main(String[] args) {
        Client client = null;
        File filePath = new File(args[0]);
        File folder = new File(args[1]);


        try {
            client = new Client(
                    // This is the interface the client will listen on (you might need something
                    // else than localhost here).
                    InetAddress.getLocalHost(),

                    // Load the torrent from the torrent file and use the given
                    // output directory. Partials downloads are automatically recovered.
                    SharedTorrent.fromFile(
                            filePath, 
                            folder));
        } catch (IOException | NoSuchAlgorithmException e1) {
            e1.printStackTrace();
        }
        client.share();
        client.waitForCompletion();

Tracker Program

public static void main(String[] args) throws IOException, NoSuchAlgorithmException {

        // First, instantiate a Tracker object with the port you want it to listen on.
        // The default tracker port recommended by the BitTorrent protocol is 6969.
        Tracker tracker = new Tracker(new InetSocketAddress(6969));
// Then, for each torrent you wish to announce on this tracker, simply created
// a TrackedTorrent object and pass it to the tracker.announce() method:
        FilenameFilter filter = new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                return name.endsWith(".torrent");
            }
        };


        for (File f : new File(args[0]).listFiles(filter)) {
            tracker.announce(TrackedTorrent.load(f));
        }
// Once done, you just have to start the tracker's main operation loop:
        tracker.start();


    }

When i run these Programs, Client Program output the log "Tracker message violates expected protocol(Could not decode tracker message(not B-encoded?)!)"
Why are these Programs don't work?Is this an issue?

@mpetazzoni
Copy link
Owner

Are you sure the Torrent file you are serving with this tracker actually points at the tracker you are running, and not some other tracker on the internet? You can use ttorrent-torrent to display information about the torrent file and show what tracker it points to.

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

No branches or pull requests

2 participants