Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: Connecting to my torrent client (I use it for legal stuff only!)

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Connecting to my torrent client (I use it for legal stuff only!)

    Hey

    It summer and I am messing around with a little project of mine.
    I am building a program (maybe app later on) to remotely
    handle my torrents (only free torrents!).

    For example:

    If I type this url (http://username:password@iport/gui/?...&s=torrentlink)

    in the browser the movie gets in my client/starts downloading. I want this to happen by my program.

    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;
     
     
    public class Connection {
    private String ip;
    private String port;
    private String username;
    private String password;
     
     
    public Connection(String ip, String port, String username, String password) {
    this.ip = ip;
    this.port = port;
    this.username = username;
    this.password = password;
    connect(this.ip, this.port);
    }
     
    private void connect(String ip, String port) {
    try {
    URL myURL = new URL("http://username:password@iport/gui/?action=add-url&s=torrentlink");
    URLConnection myURLConnection = myURL.openConnection();
    myURLConnection.connect();
     
    }
    catch (MalformedURLException e) {
    System.out.println("failed connection");
    }
    catch (IOException e) {
    System.out.println("failed connection");
     
    }
    } }



    This is what I already have, i am sure it connects but it doesn't add the torrent to my program

    Does somebody know what I need to add for it to work?

    I use it for legal stuff only!

    Thanks in advance!
    Last edited by jdruwe; August 9th, 2012 at 10:20 AM.


Similar Threads

  1. Some legal questions about programming (intellectual property)
    By clydefrog in forum Totally Off Topic
    Replies: 13
    Last Post: April 6th, 2012, 11:08 AM
  2. strong stuff
    By DarkRoast in forum Member Introductions
    Replies: 1
    Last Post: December 27th, 2010, 10:02 PM
  3. Can't get it to save stuff with JFileChooser
    By javapenguin in forum What's Wrong With My Code?
    Replies: 35
    Last Post: August 11th, 2010, 04:13 AM
  4. Method for legal moves in connect four.
    By mandar9589 in forum Algorithms & Recursion
    Replies: 3
    Last Post: December 27th, 2009, 05:28 PM
  5. VB can do stuff Java can`t ??
    By JFujy in forum Java Theory & Questions
    Replies: 2
    Last Post: September 22nd, 2009, 10:25 AM