Help in java networkign code
Hi all
i want to display URL name.When some one hit the internet explorar with url then i want ot show url name on applet. Right Now i have code which is working on consol
This is a code of Consol based Url Show:-------
import java.net.*;
import java.io.*;
public class UrlShow{
public static void main(String args[])
{
Reader kbd = new FileReader(FileDescriptor.in);
BufferedReader bufferedKbd = new BufferedReader(kbd);
try
{
String name;
do
{
System.out.print("Enter a hostname or IP address: ");
System.out.flush();
name = bufferedKbd.readLine();
if (name != null)
printRemoteAddress(name);
} while (name != null);
System.out.println("exit");
}
catch (IOException ex)
{
System.out.println("Input error:");
ex.printStackTrace();
}
}
static void printRemoteAddress(String name)
{
try
{
InetAddress addr = InetAddress.getByName(name);
System.out.println("Host name : " + addr.getHostName());
System.out.println("Host IP : " + addr.getHostAddress());
}
catch (UnknownHostException ex)
{
System.out.println("Failed " + name);
}
}
}
Plz Help me how to show url from Internet Explorer..