Menu

Ubuntu localhost IP Suggestion

2009-04-11
2012-09-15
  • Maverick Prowls

    Maverick Prowls - 2009-04-11

    Would it be possible to get this program to read from a file to retrieve the local IP address? I only ask because I already wrote a little python program which stores a simple text file containing nothing but my machine's IP on the local network and it would seem that it would be fairly trivial to ask your program to read from this file.

    Please excuse the ignorance generally, but this is my first foray into writing code and I'd like to ask, if possible, where I'd find the part of your code which determines the local IP address, then I could happily modify it myself to read from the file.

    Many thanks for writing this program, by the way, it's going to be tremendously useful for me.

     
    • Maverick Prowls

      Maverick Prowls - 2009-04-12

      Yes indeed. Sadly I have the world's most inconvenient router, the execrable LinkSys WRT54G v7, which often means that the router will continue to work normally whilst its other interfaces stop responding (UPnP, Web Interface, etc), which meant that your software was working perfectly, it was the router that was hiding from me.

      Having restarted everything, I now find that it all works. Many thanks for writing this handy program, and whilst I may not now need to do any more tweaking to make this work, my first foray into programming and scripting has given me huge numbers of other ideas I'll be trying out over the weekend.

       
    • Christoph

      Christoph - 2009-04-11

      Hello Maverick,

      thank you for using the port mapper!

      Which version are you using? If you use a version prior to 1.5, please upgrade, as this and all later versions contain a patch ( https://sourceforge.net/tracker/?func=detail&aid=2075734&group_id=213879&atid=1027468 ) that improves determining the IP address of the localhost.

      If upgrading doesn't help, I would prefer fixing the existing function, so that no external script is necessary. Please set the log level to DEBUG, open and close the "Create Preset" dialog and send the log messages.

      If it not possible to determine the IP on your machine, I could add a command line switch that reads the IP address from a file.

      The code that determines the IP address can be found in class org.chris.portmapper.router.AbstractRouter , method getLocalHostAddress ( http://upnp-portmapper.svn.sourceforge.net/viewvc/upnp-portmapper/trunk/src/org/chris/portmapper/router/AbstractRouter.java?view=markup ). The code is even documented :-)

      Kind regards,

      Christoph.

       
    • Christoph

      Christoph - 2009-04-11

      After looking at the code, found a possible error: are you connected to the router when adding a new preset? In order to use the improved method to determin the address of localhost, portmapper needs to be connected to the router, else only the 'traditional' method can be used which does not work under Ubuntu.

       

Log in to post a comment.