[JAVA 学习笔记-63]InetAddress
2016-09-28 13:12
204 查看
Class InetAddress 【代表一个IP地址】
【This class represents an Internet Protocol (IP) address.
An IP address is either a 32-bit or 128-bit unsigned number used by IP, a lower-level protocol on which protocols like UDP and TCP are built. The IP address architecture is defined by RFC 790: Assigned Numbers, RFC 1918: Address Allocation for Private Internets,
RFC 2365: Administratively Scoped IP Multicast, and RFC 2373: IP Version 6 Addressing Architecture. An instance of an InetAddress consists of an IP address and possibly its corresponding host name (depending on whether it is constructed with a host name or
whether it has already done reverse host name resolution).】
java.lang.Object
java.net.InetAddress
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Inet4Address, Inet6Address
=====================================================
Class SocketAddress
【抽象类,代表一个socket的地址,与协议无关。
It provides an immutable object used by sockets for binding, connecting, or as returned values.】
java.lang.Object
java.net.SocketAddress
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
InetSocketAddress
=======================================================
Class InetSocketAddress
【This class implements an IP Socket Address (IP address + port number) It can also be a pair (hostname + port number), in which case an attempt will be made to resolve the hostname. If resolution fails then the address is
said to be unresolved but can still be used on some circumstances like connecting through a proxy.
It provides an immutable object used by sockets for binding, connecting, or as returned values.
】
java.lang.Object
java.net.SocketAddress
java.net.InetSocketAddress
All Implemented Interfaces:
Serializable
=======================================================
【The differences and connections between InetAddress and SocketAddress】
differences:
As the Javadoc said,InetAddress consists of an IP address(no port information) and possibly its(the IP's)
corresponding host name.
SocketAddress implements an socket IP address(IP address + port number),it can also be a pair(hostname+portnumber).
Major difference is with or without portnumber information.
connections:
The latter(SocketAddress) includes the former.
【This class represents an Internet Protocol (IP) address.
An IP address is either a 32-bit or 128-bit unsigned number used by IP, a lower-level protocol on which protocols like UDP and TCP are built. The IP address architecture is defined by RFC 790: Assigned Numbers, RFC 1918: Address Allocation for Private Internets,
RFC 2365: Administratively Scoped IP Multicast, and RFC 2373: IP Version 6 Addressing Architecture. An instance of an InetAddress consists of an IP address and possibly its corresponding host name (depending on whether it is constructed with a host name or
whether it has already done reverse host name resolution).】
java.lang.Object
java.net.InetAddress
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Inet4Address, Inet6Address
=====================================================
Class SocketAddress
【抽象类,代表一个socket的地址,与协议无关。
It provides an immutable object used by sockets for binding, connecting, or as returned values.】
java.lang.Object
java.net.SocketAddress
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
InetSocketAddress
=======================================================
Class InetSocketAddress
【This class implements an IP Socket Address (IP address + port number) It can also be a pair (hostname + port number), in which case an attempt will be made to resolve the hostname. If resolution fails then the address is
said to be unresolved but can still be used on some circumstances like connecting through a proxy.
It provides an immutable object used by sockets for binding, connecting, or as returned values.
】
java.lang.Object
java.net.SocketAddress
java.net.InetSocketAddress
All Implemented Interfaces:
Serializable
=======================================================
【The differences and connections between InetAddress and SocketAddress】
differences:
As the Javadoc said,InetAddress consists of an IP address(no port information) and possibly its(the IP's)
corresponding host name.
SocketAddress implements an socket IP address(IP address + port number),it can also be a pair(hostname+portnumber).
Major difference is with or without portnumber information.
connections:
The latter(SocketAddress) includes the former.
相关文章推荐
- (Java)LeetCode-46. Permutations
- JAVA – 虚函数、抽象函数、抽象类、接口
- 深入Java内存区域
- MyEclipse破解文件+破解说明
- Java中工程、包、类介绍
- java匿名类
- 关于Spring MVC很有用的总结
- 查找一个字符串中每个单词的出现次数--Java
- rabbitmq结合spring实现消息队列优先级
- 关于spring 的那些事
- MyEclipse下修改web context root
- Intellij idea 与 MyEclipse
- Java单例模式
- java 8 新特性(5.Date-Time API)
- spring与hibernate整合
- 针对eclipse安装spring插件安装失败或者后不显示spring文件或者的解决办法
- JAVA获取时间戳,哪个更快
- Spring中bean的生命周期!
- java的特性与原则
- JAVASE 学习day1(未完)