Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
4039c78b
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4039c78b
编写于
5月 07, 2010
作者:
C
chegar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6946673: DatagramSocket.connect() documentation contradicts the implementation
Reviewed-by: alanb
上级
df93bb47
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
43 addition
and
20 deletion
+43
-20
src/share/classes/java/net/DatagramSocket.java
src/share/classes/java/net/DatagramSocket.java
+43
-20
未找到文件。
src/share/classes/java/net/DatagramSocket.java
浏览文件 @
4039c78b
...
@@ -401,29 +401,40 @@ class DatagramSocket implements java.io.Closeable {
...
@@ -401,29 +401,40 @@ class DatagramSocket implements java.io.Closeable {
* send or receive may throw a PortUnreachableException. Note, there is no
* send or receive may throw a PortUnreachableException. Note, there is no
* guarantee that the exception will be thrown.
* guarantee that the exception will be thrown.
*
*
* <p>A caller's permission to send and receive datagrams to a
* <p> If a security manager has been installed then it is invoked to check
* given host and port are checked at connect time. When a socket
* access to the remote address. Specifically, if the given {@code address}
* is connected, receive and send <b>will not
* is a {@link InetAddress#isMulticastAddress multicast address},
* perform any security checks</b> on incoming and outgoing
* the security manager's {@link
* packets, other than matching the packet's and the socket's
* java.lang.SecurityManager#checkMulticast(InetAddress)
* address and port. On a send operation, if the packet's address
* checkMulticast} method is invoked with the given {@code address}.
* is set and the packet's address and the socket's address do not
* Otherwise, the security manager's {@link
* match, an IllegalArgumentException will be thrown. A socket
* java.lang.SecurityManager#checkConnect(String,int) checkConnect}
* connected to a multicast address may only be used to send packets.
* and {@link java.lang.SecurityManager#checkAccept checkAccept} methods
* are invoked, with the given {@code address} and {@code port}, to
* verify that datagrams are permitted to be sent and received
* respectively.
*
* <p> When a socket is connected, {@link #receive receive} and
* {@link #send send} <b>will not perform any security checks</b>
* on incoming and outgoing packets, other than matching the packet's
* and the socket's address and port. On a send operation, if the
* packet's address is set and the packet's address and the socket's
* address do not match, an {@code IllegalArgumentException} will be
* thrown. A socket connected to a multicast address may only be used
* to send packets.
*
*
* @param address the remote address for the socket
* @param address the remote address for the socket
*
*
* @param port the remote port for the socket.
* @param port the remote port for the socket.
*
*
* @
exception IllegalArgumentException if the address is null,
* @
throws IllegalArgumentException
* or the port is out of range.
*
if the address is null,
or the port is out of range.
*
*
* @exception SecurityException if the caller is not allowed to
* @throws SecurityException
* send datagrams to and receive datagrams from the address and port.
* if a security manager has been installed and it does
* not permit access to the given remote address
*
*
* @see #disconnect
* @see #disconnect
* @see #send
* @see #receive
*/
*/
public
void
connect
(
InetAddress
address
,
int
port
)
{
public
void
connect
(
InetAddress
address
,
int
port
)
{
try
{
try
{
...
@@ -435,13 +446,25 @@ class DatagramSocket implements java.io.Closeable {
...
@@ -435,13 +446,25 @@ class DatagramSocket implements java.io.Closeable {
/**
/**
* Connects this socket to a remote socket address (IP address + port number).
* Connects this socket to a remote socket address (IP address + port number).
* <p>
*
* <p> If given an {@link InetSocketAddress InetSocketAddress}, this method
* behaves as if invoking {@link #connect(InetAddress,int) connect(InetAddress,int)}
* with the the given socket addresses IP address and port number.
*
* @param addr The remote address.
* @param addr The remote address.
* @throws SocketException if the connect fails
*
* @throws IllegalArgumentException if addr is null or addr is a SocketAddress
* @throws SocketException
* if the connect fails
*
* @throws IllegalArgumentException
* if {@code addr} is {@code null}, or {@code addr} is a SocketAddress
* subclass not supported by this socket
* subclass not supported by this socket
*
* @throws SecurityException
* if a security manager has been installed and it does
* not permit access to the given remote address
*
* @since 1.4
* @since 1.4
* @see #connect
*/
*/
public
void
connect
(
SocketAddress
addr
)
throws
SocketException
{
public
void
connect
(
SocketAddress
addr
)
throws
SocketException
{
if
(
addr
==
null
)
if
(
addr
==
null
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录