Java and IP address on linux

From: gurtd_dauberie_at_hta-bi.bfh.ch to send email write without _dauberie (gurtd_at_hta-bi.bfh.ch)
Date: 03/29/04


Date: 29 Mar 2004 01:22:46 -0800

I can't get the correct IP address on Linux...
The following code works properly on Windows and Unix.
But on Linux, I always get the Loopback Address (127.0.0.1)
Here is the code :
                
      //gets the IP via InetAddress class
      //works on UNIX and WIN, but not on LINUX !!
                        
      InetAddress hostIP = InetAddress.getLocalHost();
      String hostIPStr = hostIP.getHostAddress();

Could anyone help ?
Thanks in advance !
dim



Relevant Pages

  • Re: The Problems With Linux
    ... > Here are the problems with Linux: ... programmers of UNIX, Open Source software, and Shareware. ... programs only available from BSD. ... BSD code is used by Microsoft in it's Windows NT/9x/2K/XP code. ...
    (comp.os.linux)
  • Re: What is a MVP?
    ... I made no claim about my person other than I worked as support for Unix ... Windows is like a platform. ... Do I consider you to be yet another Linux troll?.. ...
    (microsoft.public.windowsxp.general)
  • RE: [Full-Disclosure] CyberInsecurity: The cost of Monopoly
    ... I've used UNIX, ... I've used/use Linux, ... > inefficient operating system - if most other Windows ... This is why I don't run POS operating systems. ...
    (Full-Disclosure)
  • Re: Linux no threat to Microsoft
    ... originally developed for Unix. ... Windows has't come on any of the machines I've ever purchased. ... Yet over those years Linux Market Share on the desktop has actually ... philosophy of Apple - later adopted by Microsoft. ...
    (comp.os.linux.setup)
  • Re: Where to start?
    ... > - NO knowledge of Linux or Unix ... Get the latest set of Slackware CD's. ... But don't hog tie yourself with the Windows way of doing things. ...
    (comp.os.linux.misc)