How to know the ip address of an website??


Just create a file name IAdd.java write the following code:-

import java.net.*;
class IAdd{
public static void main(String a[]) throws Exception{
Socket s=new Socket(a[0],Integer.parseInt(a[1]));
InetAddress add=s.getInetAddress();
System.out.println(add);
}
}

now compile the code......
$javac IAdd.java
now run the code using following command................
$java IAdd [Host Name] [port number]
suppose you want to know ip address of http://www.google.com then the command will be given below:-

for http port number is 80 ,
$java IAdd www.google.com 80

suppose you want to know ip address of ftp://www.wbut.net then the command will given below:-
$java IAdd www.wbut.net 21
here port number is 21 becuase control port of ftp is 21.






Comments

  1. good,it's good for your effort,your talent,
    keep it up, do such more and more

    ReplyDelete

Post a Comment

Popular posts from this blog

Few tips for Linux User related to MAN page

SEND Mail Using JAVA Mail API