MulticastSocket (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Constructor Summary
Constructors
Constructs a multicast socket and binds it to any available port on the local host machine.
MulticastSocket(int port) Constructs a multicast socket and binds it to the specified port on the local host machine.
Creates a multicast socket, bound to the specified local socket address.
-
Method Summary
booleanGet the multicast network interface set for outgoing multicast datagrams sent from this socket.
intGet the default time-to-live for multicast packets sent out on the socket.
voidvoidvoidvoidLeave a multicast group on a specified local interface.
voidvoidsetLoopbackMode(boolean disable) voidSpecify the network interface for outgoing multicast datagrams sent on this socket.
voidsetTimeToLive(int ttl) Set the default time-to-live for multicast packets sent out on this
MulticastSocketin order to control the scope of the multicasts.Methods declared in class DatagramSocket
bind, close, connect, 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, supportedOptionsvoidBinds this DatagramSocket to a specific address and port.
voidCloses this datagram socket.
voidConnects the socket to a remote address for this socket.
voidConnects this socket to a remote socket address (IP address + port number).
voidbooleanTests if SO_BROADCAST is enabled.
Returns the unique
DatagramChannelobject associated with this datagram socket, if any.Returns the address to which this socket is connected.
Gets the local address to which the socket is bound.
intReturns the port number on the local host to which this socket is bound.
Returns the address of the endpoint this socket is bound to.
<T> TReturns the value of a socket option.
intReturns the port number to which this socket is connected.
intGet value of the SO_RCVBUF option for this
DatagramSocket, that is the buffer size, in bytes, used by the platform for input on thisDatagramSocket.Returns the address of the endpoint this socket is connected to, or
nullif it is unconnected.booleanTests if SO_REUSEADDR is enabled.
intGet value of the SO_SNDBUF option for this
DatagramSocket, that is the buffer size, in bytes, used by the platform for output on thisDatagramSocket.intRetrieve setting for SO_TIMEOUT. 0 returns implies that the option is disabled (i.e., timeout of infinity).
intGets traffic class or type-of-service in the IP datagram header for packets sent from this DatagramSocket.
booleanReturns the binding state of the socket.
booleanReturns whether the socket is closed or not.
booleanReturns the connection state of the socket.
voidReceives a datagram packet from this socket.
voidSends a datagram packet from this socket.
voidEnable/disable SO_BROADCAST.
static voidSets the value of a socket option.
voidSets the SO_RCVBUF option to the specified value for this
DatagramSocket.voidEnable/disable the SO_REUSEADDR socket option.
voidSets the SO_SNDBUF option to the specified value for this
DatagramSocket.voidEnable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
voidSets traffic class or type-of-service octet in the IP datagram header for datagrams sent from this DatagramSocket.
Returns a set of the socket options supported by this socket.
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitCreates and returns a copy of this object.
booleanIndicates whether some other object is "equal to" this one.
protected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.intReturns a hash code value for this object.
final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
Returns a string representation of the object.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
MulticastSocket
-
MulticastSocket
-
MulticastSocket
-
-
Method Details
-
setTimeToLive
-
getTimeToLive
-
joinGroup
-
leaveGroup
-
joinGroup
-
leaveGroup
-
setInterface
-
getInterface
-
setNetworkInterface
-
getNetworkInterface
-
setLoopbackMode
-
getLoopbackMode
-