2011년 09월 21일
도메인클럽, 국제도메인 연장 시 5,000원 할인 및 누구나 참여하는 이벤트 소문내기!
# by | 2011/09/21 10:43 | 트랙백 | 덧글(0)
# by | 2011/09/21 10:43 | 트랙백 | 덧글(0)
# by | 2011/03/24 12:26 | 트랙백 | 덧글(0)
import java.net.*;
class InetAddress1
{
public static void main(String[] ar) throws UnknownHostException
{
InetAddress addr1=InetAddress.getByName("www.cyber.co.kr");
InetAddress addr2=InetAddress.getByName("220.79.181.253");
InetAddress addr3=InetAddress.getLocalHost();
System.out.println("=====================================================");
System.out.println("addr1="+addr1.getHostAddress()); //addr1의 IP주소
System.out.println("addr2="+addr2.getHostName()); //addr2의 IP주소
System.out.println("로컬 수조="+addr3.getHostAddress()); //현재 내 PC 주소
System.out.println("로컬 이름="+addr3.getHostName()); //현재 내 PC 이름
}
}
import java.net.*;
import java.io.*;
class InetAddress2
{
public static void main(String[] ar) throws Exception
{
String url=null;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); //웹사이트 주소를 입력 받기
System.out.print("웹사이트 주소 입력 >> "); //입력
url=br.readLine(); //실제로 입력 받음
InetAddress addr=InetAddress.getByName(url); //InetAddress로 객체 반환?
System.out.println("===============================================================");
System.out.println(url+"의 IP 번호 ="+addr.getHostAddress()); //addr에 저장된 주소를 host주소로 바꿈
}
}
import java.net.*;
import java.io.*;
class InetAddress3
{
public static void main(String[] ar) throws Exception
{
String url=null;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("웹사이트 주소 입력 >> ");
url=br.readLine();
InetAddress [] addr=InetAddress.getAllByName(url); //url을 저장하기 우해 배열 생성
System.out.println("================================================");
System.out.println(url+"는"+addr.length+"개의 IP주소를 갖고 있습니다.");
for(int i=0;i<addr.length;i++){
System.out.println((i+1)+"번 IP 주소 =" +addr[i].getHostAddress()); //웹사이트가 갖고 있는 host주소를 for문으로 출력함
}
}
}
# by | 2008/11/24 18:17 | 수업시간 | 트랙백 | 덧글(1)
◀ 이전 페이지다음 페이지 ▶