Thread: Making client ip change[any revision]

Results 1 to 6 of 6
  1. #1 Making client ip change[any revision] 
    Renown Programmer


    Join Date
    Jul 2009
    Posts
    1,846
    Thanks given
    69
    Thanks received
    1,107
    Rep Power
    3170
    Purpose:title
    Difficulty:1/10
    Classes Modified:client.java (and) others
    Tested On(if it applies):562


    This is a very simple tutorial how to make your client ipchanger
    with abilty to change ip and port

    So lets start

    First open your client.java and after

    Code:
    public class client extends Applet_Sub1
    {
    put
    Code:
    	public static String ip = "";
    	public static int port = 0;
    !Don't change theese , because theese are setup later!

    now search for
    Code:
    public static void main(String[] arg0) {
    and after that put
    Code:
    	ip = arg0[4];
    	port = arg0[5];
    so we make that theese vars are set up on client startup with given params.

    now find where your ip are
    for me its in
    Code:
    Class131_Sub41_Sub20.anInt6436 = 43594;
    Class131_Sub2_Sub7.aString5636 ="127.0.0.1";
    and change them to
    Code:
    Class131_Sub41_Sub20.anInt6436 = this.port;
    Class131_Sub2_Sub7.aString5636 =this.ip;
    Your almost done
    Compile your client.

    now we just need to make proper launcher for it

    open your run.bat or whatever you have

    and find line like
    java -cp bin;lib/clientlibs.jar client 0 live english game0
    you see the params are client 0 live english game0
    but if you try to start it fails because we are now missing ip and port
    so it should look like
    java -cp bin;lib/clientlibs.jar client 0 live english game0 127.0.0.1 43594
    but it would be unconfortable to edit it so add theese lines on the top
    set /p ip=Enter ip:
    set /p port=Enter port:
    and now your line
    java -cp bin;lib/clientlibs.jar client 0 live english game0 %ip% %port%

    Now Your Done

    Rep ++ if helped
     

  2. #2  
    Registered Member Glabay's Avatar
    Join Date
    Jul 2008
    Age
    31
    Posts
    1,212
    Thanks given
    141
    Thanks received
    55
    Discord
    View profile
    Rep Power
    455
    Code:
                System.out.println("Which IP would you like to load?");
                System.out.println("\nSelect a number\n"
                                   + "0 = Your choice\n"
                                   + "1 = LocalHost\n");
                int SERVER_IP = Integer.parseInt(input.readLine());
                if (SERVER_IP == 0) {
                    System.out.println("New IP?");
                    newIp = input.readLine();
                }
                System.out.println("Appending connection to: " + getIP(SERVER_IP));
                Class68_Sub9.aString2883 = getIP(SERVER_IP);

    and at bottom

    Code:
        private static String getIP(int ip) throws IOException {
            switch (ip) {
                case 0: return newIp;
                case 1: return "localhost";
            }
            return "localhost";
        }
    
        static String newIp = "";
        static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    you can also add in favored servers you enjoy playing in the switch

    This will ask you the server ip you want on the command window before it loads a client.


    your is easy to tho.
    PI * 13.37 = 42
    There are 10 kinds of people; those who know Binary and those who don't
    Why programmers confuse Christmas and Halloween; Because 31 OCT = 25 DEC.
     

  3. #3  
    Registered Member Erand's Avatar
    Join Date
    Dec 2009
    Age
    24
    Posts
    580
    Thanks given
    87
    Thanks received
    5
    Rep Power
    10
    Quote Originally Posted by Glabay View Post
    Code:
                System.out.println("Which IP would you like to load?");
                System.out.println("\nSelect a number\n"
                                   + "0 = Your choice\n"
                                   + "1 = LocalHost\n");
                int SERVER_IP = Integer.parseInt(input.readLine());
                if (SERVER_IP == 0) {
                    System.out.println("New IP?");
                    newIp = input.readLine();
                }
                System.out.println("Appending connection to: " + getIP(SERVER_IP));
                Class68_Sub9.aString2883 = getIP(SERVER_IP);

    and at bottom

    Code:
        private static String getIP(int ip) throws IOException {
            switch (ip) {
                case 0: return newIp;
                case 1: return "localhost";
            }
            return "localhost";
        }
    
        static String newIp = "";
        static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    you can also add in favored servers you enjoy playing in the switch

    This will ask you the server ip you want on the command window before it loads a client.


    your is easy to tho.

    nice but u could add a joption pane to make it look better
    Thanks Luigi

    im back

    Proud Ubuntu User
     

  4. #4  
    Registered Member Glabay's Avatar
    Join Date
    Jul 2008
    Age
    31
    Posts
    1,212
    Thanks given
    141
    Thanks received
    55
    Discord
    View profile
    Rep Power
    455
    I did it for a personal use on my IDE lol too lazy to add in anything else
    PI * 13.37 = 42
    There are 10 kinds of people; those who know Binary and those who don't
    Why programmers confuse Christmas and Halloween; Because 31 OCT = 25 DEC.
     

  5. #5  
    Respected Member


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    32
    Posts
    12,549
    Thanks given
    177
    Thanks received
    5,789
    Discord
    View profile
    Rep Power
    5000
    Good job man, haters gonna hate..this is fine .
     

  6. #6  
    Registered Member
    Join Date
    Jul 2010
    Posts
    4
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Quote Originally Posted by Luke132 View Post
    Good job man, haters gonna hate..this is fine .
    This ^_^
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •