public abstract class DatagramSocketImpl extends Object implements SocketOptions
Modifier and Type | Field and Description |
---|---|
protected FileDescriptor |
fd
文件描述符对象。
|
protected int |
localPort
本地端口号。
|
IP_MULTICAST_IF, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS, SO_BINDADDR, SO_BROADCAST, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY
Constructor and Description |
---|
DatagramSocketImpl() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
bind(int lport, InetAddress laddr)
结合数据报套接字到本地端口和地址。
|
protected abstract void |
close()
关闭插座。
|
protected void |
connect(InetAddress address, int port)
一个数据报套接字连接到远程目的地。
|
protected abstract void |
create()
创建一个数据报套接字。
|
protected void |
disconnect()
断开数据报套接字从遥远的目的地。
|
protected FileDescriptor |
getFileDescriptor()
获取的数据报套接字的文件描述符。
|
protected int |
getLocalPort()
获取本地端口。
|
protected abstract int |
getTimeToLive()
检索的TTL(生存时间)的选择。
|
protected abstract byte |
getTTL()
过时的。
使用gettimetolive相反。
|
protected abstract void |
join(InetAddress inetaddr)
加入多播组。
|
protected abstract void |
joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
加入多播组。
|
protected abstract void |
leave(InetAddress inetaddr)
离开组播组。
|
protected abstract void |
leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
离开组播组。
|
protected abstract int |
peek(InetAddress i)
偷看包,看看是谁从。
|
protected abstract int |
peekData(DatagramPacket p)
偷看包,看看是谁从。
|
protected abstract void |
receive(DatagramPacket p)
接收数据包。
|
protected abstract void |
send(DatagramPacket p)
发送一个数据包。
|
protected abstract void |
setTimeToLive(int ttl)
设置TTL(生存时间)的选择。
|
protected abstract void |
setTTL(byte ttl)
过时的。
使用settimetolive相反。
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getOption, setOption
protected int localPort
protected FileDescriptor fd
protected abstract void create() throws SocketException
SocketException
-如果在底层协议有错误,例如TCP错误。
protected abstract void bind(int lport, InetAddress laddr) throws SocketException
lport
-本地端口
laddr
-本地地址
SocketException
-如果在底层协议有错误,例如TCP错误。
protected abstract void send(DatagramPacket p) throws IOException
p
-。
IOException
如果发生I/O异常时发送的数据包。
PortUnreachableException
可能如果插座连接到目前遥不可及的目标投掷。注意,没有保证将被抛出的异常。
protected void connect(InetAddress address, int port) throws SocketException
如果远程目的地插座连接不存在,或者是遥不可及的,如果一个ICMP目的不可达报文已收到,地址,随后电话发送或接收可能会抛出一个portunreachableexception。注意,没有保证将被抛出的异常。
address
-连接到远程InetAddress
port
-远程端口号
SocketException
可能如果插座不能连接到远程目的地扔
protected void disconnect()
protected abstract int peek(InetAddress i) throws IOException
InetAddress
包所来自的地址。
i
- InetAddress对象
IOException
如果发生I/O异常
PortUnreachableException
可能如果插座连接到目前遥不可及的目标投掷。注意,没有保证将被抛出的异常。
protected abstract int peekData(DatagramPacket p) throws IOException
DatagramPacket
。数据被返回,但没有消耗,使后续的peekdata /接收操作将看到相同的数据。
p
-收到的数据包。
IOException
如果发生I/O异常
PortUnreachableException
可能如果插座连接到目前遥不可及的目标投掷。注意,没有保证将被抛出的异常。
protected abstract void receive(DatagramPacket p) throws IOException
p
-收到的数据包。
IOException
如果发生I/O异常而接收的数据包。
PortUnreachableException
可能如果插座连接到目前遥不可及的目标投掷。注意,没有保证将被抛出的异常。
@Deprecated protected abstract void setTTL(byte ttl) throws IOException
ttl
-一个字节指定TTL值
IOException
如果发生I/O异常而设置生存时间的选择。
getTTL()
@Deprecated protected abstract byte getTTL() throws IOException
IOException
如果发生I/O异常在获取生存时间的选择
setTTL(byte)
protected abstract void setTimeToLive(int ttl) throws IOException
ttl
指定生存时间值的
int
IOException
如果发生I/O异常而设置生存时间的选择。
getTimeToLive()
protected abstract int getTimeToLive() throws IOException
int
IOException
如果发生I/O异常在获取生存时间的选择
setTimeToLive(int)
protected abstract void join(InetAddress inetaddr) throws IOException
inetaddr
组播地址加入。
IOException
如果发生I/O异常而加入多播组。
protected abstract void leave(InetAddress inetaddr) throws IOException
inetaddr
组播地址离开。
IOException
如果发生I/O异常而离开组播组。
protected abstract void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) throws IOException
mcastaddr
地址加入。
netIf
-指定本地接口接收组播数据包
IOException
如果发生I/O异常而加入多播组
protected abstract void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) throws IOException
mcastaddr
地址离开。
netIf
指定的本地接口离开组
IOException
如果发生I/O异常而离开组播组
protected abstract void close()
protected int getLocalPort()
int
代表本地端口值
protected FileDescriptor getFileDescriptor()
FileDescriptor
对象
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.