Modifier and Type | Class and Description |
---|---|
private static class | DatagramSocketAdaptor.
Provides access to non-public constants in DatagramSocket. |
private static class | DatagramSocketAdaptor.
Defines static methods to invoke non-public NetworkInterface methods. |
Modifier and Type | Field and Description |
---|---|
private final DatagramChannelImpl | |
private InetAddress | |
private final Object | |
private NetworkInterface | |
private final ReentrantLock | |
private volatile int |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private InetAddress | |
private NetworkInterface | |
public void | bind(SocketAddress
The address and port to bind to. local)Overrides java. Binds this DatagramSocket to a specific address and port. |
private static InetAddress | Returns: the multicast groupChecks a SocketAddress to ensure that it is a multicast address. |
public void | close()
Overrides java. Implements java. Closes this datagram socket. |
public void | connect(InetAddress
the remote address for the socket address, int the remote port for the socket. port)Overrides java. Connects the socket to a remote address for this socket. |
public void | connect(SocketAddress
The remote address. remote)Overrides java. Connects this socket to a remote socket address (IP address + port number). |
private void | |
pack-priv static DatagramSocket | |
private NetworkInterface | defaultNetworkInterface()
Returns the default NetworkInterface to use when joining or leaving a multicast group and a network interface is not specified. |
public void | |
private boolean | |
public boolean | |
public DatagramChannel | getChannel()
Overrides java. Returns the unique |
public InetAddress | getInetAddress()
Overrides java. Returns the address to which this socket is connected. |
public InetAddress | getInterface()
Overrides java.
Deprecated
Retrieve the address of the network interface used for multicast packets. |
private int | |
public InetAddress | getLocalAddress()
Overrides java. Gets the local address to which the socket is bound. |
public int | getLocalPort()
Overrides java. Returns the port number on the local host to which this socket is bound. |
public SocketAddress | getLocalSocketAddress()
Overrides java. Returns the address of the endpoint this socket is bound to. |
public boolean | getLoopbackMode()
Overrides java.
Deprecated
Get the setting for local loopback of multicast datagrams. |
public NetworkInterface | getNetworkInterface()
Overrides java. Get the multicast network interface set for outgoing multicast datagrams sent from this socket. |
public <T> T | getOption(SocketOption<T>
The socket option name)Overrides java. Returns the value of a socket option. |
public int | getPort()
Overrides java. Returns the port number to which this socket is connected. |
public int | getReceiveBufferSize()
Overrides java. Get value of the SO_RCVBUF option for this |
public SocketAddress | getRemoteSocketAddress()
Overrides java. Returns the address of the endpoint this socket is connected to, or
|
public boolean | getReuseAddress()
Overrides java. Tests if SO_REUSEADDR is enabled. |
public int | getSendBufferSize()
Overrides java. Get value of the SO_SNDBUF option for this |
public int | |
public int | getTimeToLive()
Overrides java. Get the default time-to-live for multicast packets sent out on the socket. |
public int | getTrafficClass()
Overrides java. Gets traffic class or type-of-service in the IP datagram header for packets sent from this DatagramSocket. |
public byte | getTTL()
Overrides java. Get the default time-to-live for multicast packets sent out on the socket. |
public boolean | |
public boolean | |
public boolean | isConnected()
Overrides java. Returns the connection state of the socket. |
public void | joinGroup(InetAddress
is the multicast address to join group)Overrides java.
Deprecated
Joins a multicast group. |
public void | joinGroup(SocketAddress
indicates the multicast address to join. mcastaddr, NetworkInterface specifies the local interface to receive multicast
datagram packets, or netIf)null .Overrides java. Joins a multicast group. |
public void | leaveGroup(InetAddress
is the multicast address to leave group)Overrides java.
Deprecated
Leave a multicast group. |
public void | leaveGroup(SocketAddress
is the multicast address to leave. This should
contain the same IP address than that used for joining
the group. mcastaddr, NetworkInterface specifies the local interface or netIf)null to defer
to the interface set for outgoing multicast datagrams.
If null , and no interface has been set, the behaviour
is unspecified: any interface may be selected or the operation
may fail with a SocketException .Overrides java. Leave a multicast group on a specified local interface. |
private NetworkInterface | |
public void | receive(DatagramPacket
the p)DatagramPacket into which to place
the incoming data.Overrides java. Receives a datagram packet from this socket. |
public void | send(DatagramPacket
the p)DatagramPacket to be sent.Overrides java. Sends a datagram packet from this socket. |
public void | send(DatagramPacket
is the packet to be sent. The packet should contain
the destination multicast ip address and the data to be sent.
One does not need to be the member of the group to send
packets to a destination multicast address. p, byte optional time to live for multicast packet.
default ttl is 1. ttl)Overrides java. Sends a datagram packet to the destination, with a TTL (time-to-live) other than the default for the socket. |
private void | |
public void | setBroadcast(boolean
whether or not to have broadcast turned on. on)Overrides java. Enable/disable SO_BROADCAST. |
public void | setInterface(InetAddress
the InetAddress inf)Overrides java.
Deprecated
Set the multicast network interface used by methods whose behavior would be affected by the value of the network interface. |
private void | |
public void | setLoopbackMode(boolean
true to disable the LoopbackModeOverrides java.
Deprecated
Disable/Enable local loopback of multicast datagrams. |
public void | setNetworkInterface(NetworkInterface
the interface netIf)Overrides java. Specify the network interface for outgoing multicast datagrams sent on this socket. |
public <T> DatagramSocket | setOption(SocketOption<T>
The socket option name, T The value of the socket option. A value of value)null
may be valid for some options.Overrides java. Sets the value of a socket option. |
public void | setReceiveBufferSize(int
the size to which to set the receive buffer
size, in bytes. This value must be greater than 0. size)Overrides java. Sets the SO_RCVBUF option to the specified value for this
|
public void | setReuseAddress(boolean
whether to enable or disable the on)Overrides java. Enable/disable the SO_REUSEADDR socket option. |
public void | setSendBufferSize(int
the size to which to set the send buffer
size, in bytes. This value must be greater than 0. size)Overrides java. Sets the SO_SNDBUF option to the specified value for this
|
public void | setSoTimeout(int
the specified timeout in milliseconds. timeout)Overrides java. Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. |
public void | setTimeToLive(int
the time-to-live ttl)Overrides java. Set the default time-to-live for multicast packets sent out
on this |
public void | setTrafficClass(int
an tc)int value for the bitset.Overrides java. Sets traffic class or type-of-service octet in the IP datagram header for datagrams sent from this DatagramSocket. |
public void | setTTL(byte
the time-to-live ttl)Overrides java. Set the default time-to-live for multicast packets sent out
on this |
public Set | supportedOptions()
Overrides java. Returns a set of the socket options supported by this socket. |