< prev index next >

src/java.base/share/classes/java/net/MulticastSocket.java

Print this page

104  *          The {@link MulticastChannel} API supports both {@linkplain
105  *          MulticastChannel#join(InetAddress, NetworkInterface) any-source} and
106  *          {@linkplain MulticastChannel#join(InetAddress, NetworkInterface, InetAddress)
107  *          source-specific} multicast. Consider using {@link DatagramChannel} for
108  *          multicasting.
109  *
110  * @author Pavani Diwanji
111  * @since 1.1
112  */
113 public class MulticastSocket extends DatagramSocket {
114 
115     @Override
116     final MulticastSocket delegate() {
117         return (MulticastSocket) super.delegate();
118     }
119 
120     /**
121      * Create a MulticastSocket that delegates to the given delegate if not null.
122      * @param delegate the delegate, can be null.
123      */
124     MulticastSocket(MulticastSocket delegate)  {
125         super(delegate);
126     }
127 
128 
129     /**
130      * Constructs a multicast socket and binds it to any available port
131      * on the local host machine.  The socket will be bound to the
132      * {@link InetAddress#isAnyLocalAddress wildcard} address.
133      *
134      * <p>
135      * If there is a security manager, its {@code checkListen} method is first
136      * called with 0 as its argument to ensure the operation is allowed. This
137      * could result in a SecurityException.
138      * <p>
139      * When the socket is created the
140      * {@link DatagramSocket#setReuseAddress(boolean)} method is called to
141      * enable the SO_REUSEADDR socket option.
142      *
143      * @throws    IOException if an I/O exception occurs while creating the
144      * MulticastSocket
145      * @throws    SecurityException if a security manager exists and its
146      * {@code checkListen} method doesn't allow the operation.
147      * @see SecurityManager#checkListen
148      * @see java.net.DatagramSocket#setReuseAddress(boolean)

104  *          The {@link MulticastChannel} API supports both {@linkplain
105  *          MulticastChannel#join(InetAddress, NetworkInterface) any-source} and
106  *          {@linkplain MulticastChannel#join(InetAddress, NetworkInterface, InetAddress)
107  *          source-specific} multicast. Consider using {@link DatagramChannel} for
108  *          multicasting.
109  *
110  * @author Pavani Diwanji
111  * @since 1.1
112  */
113 public class MulticastSocket extends DatagramSocket {
114 
115     @Override
116     final MulticastSocket delegate() {
117         return (MulticastSocket) super.delegate();
118     }
119 
120     /**
121      * Create a MulticastSocket that delegates to the given delegate if not null.
122      * @param delegate the delegate, can be null.
123      */
124     MulticastSocket(MulticastSocket delegate) {
125         super(delegate);
126     }
127 

128     /**
129      * Constructs a multicast socket and binds it to any available port
130      * on the local host machine.  The socket will be bound to the
131      * {@link InetAddress#isAnyLocalAddress wildcard} address.
132      *
133      * <p>
134      * If there is a security manager, its {@code checkListen} method is first
135      * called with 0 as its argument to ensure the operation is allowed. This
136      * could result in a SecurityException.
137      * <p>
138      * When the socket is created the
139      * {@link DatagramSocket#setReuseAddress(boolean)} method is called to
140      * enable the SO_REUSEADDR socket option.
141      *
142      * @throws    IOException if an I/O exception occurs while creating the
143      * MulticastSocket
144      * @throws    SecurityException if a security manager exists and its
145      * {@code checkListen} method doesn't allow the operation.
146      * @see SecurityManager#checkListen
147      * @see java.net.DatagramSocket#setReuseAddress(boolean)
< prev index next >