Code/JAVA

도메인대역 검사 ( newBcode 봇탱이를 위한. 기능.. 1번)..

알 수 없는 사용자 2007. 5. 11. 21:51

#newbcode 채널에 자바 봇을 한번 만들어볼 생각으로-ㅁ ㅡ;
봇부터 만들면-ㅁ ㅡ; 귀찮아서.. 안할꺼같아.. 기능부터 만드는 중이라는
-ㅁ ㅡ; 덜덜덜 
이넘의 귀차니즘....

================================================================================
import java.net.*;
import java.io.*;

public class ex6 {
 public static void main(String ex6[]) throws IOException {
  BufferedReader in = new BufferedReader(new BufferedReader(new InputStreamReader(System.in)));
 
  String domain = "";
       
  System.out.println("ex) \"www.newbcode.org\" => newbcode.org");
  System.out.print("도메인  : ");
  domain = in.readLine();
  System.out.println("");
 
  InetAddress[] a = null;
  try {
   a = InetAddress.getAllByName(domain);
  }catch(UnknownHostException ee) {
   System.err.println("에러 (error) == 없다  (null)");
   System.exit(1);
  }
 
  System.out.print("도메인  (" + domain + ") 의 결과 \n====================\n");
 
  for(int i = 0; i < a.length; i++) {
   System.out.print(domain + "의 " + i + " 번째 IP =" + a[i].getHostAddress() + "\n");
  }
 
  System.out.println("====================\n검색 종료 ");
 
 }
}
===============================================================================