Lập trình mạng - Internet Address

InetAddress không có constructor  public static InetAddress InetAddress.getByName(String hostname) Kết nối đến 1 máy chủ, tham số là 1 chuỗi ký tự (tên máy, địa chỉ IP, địa chỉ 1 trang web, )  public static InetAddress[ ] InetAddress.getAllByName(String hostname) Kết quả trả về là 1 mảng đối tượng thuộc kiểu InetAddress  public static InetAddress InetAddress.getLocalHost() Đọc thông tin của máy cục bộ đang làm việc

pdf11 trang | Chia sẻ: nguyenlam99 | Lượt xem: 948 | Lượt tải: 0download
Bạn đang xem nội dung tài liệu Lập trình mạng - Internet Address, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
Internet Address Nguyễn Hữu Thể LẬP TRÌNH MẠNG Class InetAddress  Class InetAddress: truy xuất thông tin hostname hoặc IP.  Thư viện: java.net  Cấu trúc class InetAddress: Class InetAddress - Method  InetAddress không có constructor  public static InetAddress InetAddress.getByName(String hostname) Kết nối đến 1 máy chủ, tham số là 1 chuỗi ký tự (tên máy, địa chỉ IP, địa chỉ 1 trang web,)  public static InetAddress[ ] InetAddress.getAllByName(String hostname) Kết quả trả về là 1 mảng đối tượng thuộc kiểu InetAddress  public static InetAddress InetAddress.getLocalHost() Đọc thông tin của máy cục bộ đang làm việc. Class InetAddress – Method (2)  Một số phương thức khác:  public String getHostName() Trả về một chuỗi biểu diễn hostname của một đối tượng InetAddress.  public String getHostAddress() Trả về một chuỗi biểu diễn địa chỉ IP của một đối tượng InetAddress.  public byte[ ] getAddress() Trả về một địa chỉ IP dưới dạng một mảng các byte. Class InetAddress – Example 1  Read HostName, IP Address, Domain Name Class InetAddress- Example 2  Hostname, ip address website Class InetAddress- Example 3  List hostname, ip address website Class InetAddress- Example 4  IP thuộc class A, B, C: Class InetAddress Class InetAddress Class InetAddress

Các file đính kèm theo tài liệu này:

  • pdf4_internet_address_4217.pdf
Tài liệu liên quan