How to find local IP

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to find local IP

Dennis Peterson
I would like to build a TCP/IP app but need to determine the local  IP assigned at the
time of a PPP or sl/ip  connection. Since this app may (will!) be used on a system with a
TCP/IP LAN, this complicates things. In Unix and OS/2 I would use the ifconfig tool but
this has to be platform independant, as should all good Java apps.

Can anyone suggest a way to discover all IP's for multi-homed systems and to
determine which is which, regardless of the platform?

dp

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: How to find local IP

Massimiliano Marsiglietti
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: [hidden email]
Errors-To: [hidden email]
Precedence: bulk

Dennis Peterson wrote:

> I would like to build a TCP/IP app but need to determine the local  IP assigned at the
> time of a PPP or sl/ip  connection. Since this app may (will!) be used on a system with a
> TCP/IP LAN, this complicates things. In Unix and OS/2 I would use the ifconfig tool but
> this has to be platform independant, as should all good Java apps.
>
> Can anyone suggest a way to discover all IP's for multi-homed systems and to
> determine which is which, regardless of the platform?
>

  You may want to check the java.net.InetAddress class (I have the 1.1 API HTML docs right
here -- fin it there), expecially methods:

getLocalHost
getAllByName

Max



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>