-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable,org.ice4j.socket.MultiplexedXXXSocket
public class MultiplexedDatagramSocket extends DelegatingDatagramSocket implements MultiplexedXXXSocket
Represents a DatagramSocket which receives DatagramPackets selected by a DatagramPacketFilter from a MultiplexingDatagramSocket. The associated MultiplexingDatagramSocket is the actual DatagramSocket which reads the DatagramPackets from the network. The DatagramPackets received through the MultiplexedDatagramSocket will not be received through the associated MultiplexingDatagramSocket.
-
-
Field Summary
Fields Modifier and Type Field Description private final DatagramPacketFilterfilter
-
Method Summary
Modifier and Type Method Description DatagramPacketFiltergetFilter()Gets the DatagramPacketFilter} which determines which DatagramPacket}s read from the network are to be received through this socket. voidclose()Closes this datagram socket. voidreceive(DatagramPacket p)Receives a datagram packet from this socket. -
Methods inherited from class org.ice4j.socket.DelegatingDatagramSocket
bind, connect, connect, disconnect, getBroadcast, getChannel, getInetAddress, getLocalAddress, getLocalPort, getLocalSocketAddress, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoTimeout, getTrafficClass, isBound, isClosed, isConnected, send, setBroadcast, setDefaultDelegateFactory, setDefaultReceiveBufferSize, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoTimeout, setTrafficClass -
Methods inherited from class java.net.DatagramSocket
bind, close, connect, disconnect, getBroadcast, getChannel, getInetAddress, getLocalAddress, getLocalPort, getLocalSocketAddress, getOption, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoTimeout, getTrafficClass, isBound, isClosed, isConnected, receive, send, setBroadcast, setDatagramSocketImplFactory, setOption, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoTimeout, setTrafficClass, supportedOptions -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getFilter
DatagramPacketFilter getFilter()
Gets the DatagramPacketFilter} which determines which DatagramPacket}s read from the network are to be received through this socket.
-
close
void close()
Closes this datagram socket.
Any thread currently blocked in receive upon this socket will throw a SocketException.
-
receive
void receive(DatagramPacket p)
Receives a datagram packet from this socket. When this method returns, the DatagramPacket's buffer is filled with the data received. The datagram packet also contains the sender's IP address, and the port number on the sender's machine.
This method blocks until a datagram is received. The length field of the datagram packet object contains the length of the received message. If the message is longer than the packet's length, the message is truncated.
If there is a security manager, a packet cannot be received if the security manager's checkAccept method does not allow it.
- Parameters:
p- the DatagramPacket into which to place the incoming data
-
-
-
-