Step 1: Open the text editor.
Step 2:Write the codings on the editor.
Step 3:Include the necessary packages.
Step 4:include the code
InetAddress.getByName()
To get the remote IP address of the system.
Step 5:save the program with .java extension.
Step 6:Run the program.
Step 7:the remote IP address will be displayed .
PROGRAM
import java.io.*;
import java.net.*;
class second
{
public static void main(String args[])
{
for(int i=1;i<=10;i++)
{
try
{
System.out.println(" RemoteAddress "+i+":"+InetAddress.getByName("lab17-"+i));
}
catch(Exception e)
{
System.out.println("system "+i+"is off");
}
}
}
}
OUTPUT
C:\jdk1.3\bin>javac second.java
C:\jdk1.3\bin>java second
system 1is off
RemoteAddress 2:lab17-2/192.168.7.82
RemoteAddress 3:lab17-3/192.168.7.83
RemoteAddress 4:lab17-4/192.168.7.84
RemoteAddress 5:lab17-5/192.168.7.85
RemoteAddress 6:lab17-6/192.168.7.86
system 7is off
RemoteAddress 8:lab17-8/192.168.7.88
RemoteAddress 9:lab17-9/192.168.7.89
system 10is off