Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

port forward problem

Options
  • 04-11-2011 1:00pm
    #1
    Registered Users Posts: 1,180 ✭✭✭


    Hi, simple question regarding port forwarding. i have a simple java server i want accessible from the entire internet, so i'm trying to forward port 4242 to my laptops ip address. however my cisco router is telling me it's an invalid ip address when i try to port forward.
    has anybody any idea on what i'm doing wrong? i don't understand NATs too much and i'm almost certain this isn't a firewall problem
    try{
                //makes a socket listening on port 4242
                ServerSocket serverSocket = new ServerSocket(4242);
            
                while(true){
                    Socket socket = serverSocket.accept();
                    InputStreamReader streamReader = new InputStreamReader(socket.getInputStream());
                    BufferedReader reader = new BufferedReader(streamReader);
                    
                    String input = reader.readLine();
                    System.out.println(input);                
                }    
            }
            catch(Exception ex){
                ex.printStackTrace();
            }
    


Comments

  • Registered Users Posts: 5,376 ✭✭✭DublinDilbert


    How is your laptop getting its IP on the local network? is it via DHCP or Static? You should set up your laptop to have a static IP address locally then forward the required ports onto this address. The static IP address you assign to your laptop should be outside the range of dynamic IPs that the router assigns.


  • Registered Users Posts: 1,180 ✭✭✭EyeSight


    How is your laptop getting its IP on the local network? is it via DHCP or Static? You should set up your laptop to have a static IP address locally then forward the required ports onto this address. The static IP address you assign to your laptop should be outside the range of dynamic IPs that the router assigns.
    Thanks for the reply

    I have given my laptop a static ip: 192.168.1.100
    And i have forwarded the port like so:
    Local IP Adr: 192.168.1.100
    Start Port : 4242
    End Port: 4242
    Protocol: both


    in my client i connect via the ip address of the router to port 4242 however it still does not connect. any idea on what i'm missing?


  • Registered Users Posts: 2,660 ✭✭✭Baz_


    Can you connect from another computer within the lan? Is the server definitely working?


  • Registered Users Posts: 1,180 ✭✭✭EyeSight


    sorry! i restarted everything and it seems to work now.

    thanks a lot! :)


Advertisement