Share via


MulticastSocket Constructors

Definition

Overloads

MulticastSocket()

Create a multicast socket.

MulticastSocket(SocketAddress)

Create a MulticastSocket bound to the specified socket address.

MulticastSocket(Int32)

Create a multicast socket and bind it to a specific port.

MulticastSocket(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

MulticastSocket()

Create a multicast socket.

[Android.Runtime.Register(".ctor", "()V", "")]
public MulticastSocket ();
Attributes

Exceptions

if an error occurs.

Remarks

Create a multicast socket.

If there is a security manager, its checkListen method is first called with 0 as its argument to ensure the operation is allowed. This could result in a SecurityException.

When the socket is created the DatagramSocket#setReuseAddress(boolean) method is called to enable the SO_REUSEADDR socket option.

Java documentation for java.net.MulticastSocket.MulticastSocket().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

MulticastSocket(SocketAddress)

Create a MulticastSocket bound to the specified socket address.

[Android.Runtime.Register(".ctor", "(Ljava/net/SocketAddress;)V", "")]
public MulticastSocket (Java.Net.SocketAddress? bindaddr);
[<Android.Runtime.Register(".ctor", "(Ljava/net/SocketAddress;)V", "")>]
new Java.Net.MulticastSocket : Java.Net.SocketAddress -> Java.Net.MulticastSocket

Parameters

bindaddr
SocketAddress

Socket address to bind to, or null for an unbound socket.

Attributes

Exceptions

if localAddress is not supported (because it's not an InetSocketAddress, say).

if an error occurs.

Remarks

Create a MulticastSocket bound to the specified socket address.

Or, if the address is null, create an unbound socket.

If there is a security manager, its checkListen method is first called with the SocketAddress port as its argument to ensure the operation is allowed. This could result in a SecurityException.

When the socket is created the DatagramSocket#setReuseAddress(boolean) method is called to enable the SO_REUSEADDR socket option.

Added in 1.4.

Java documentation for java.net.MulticastSocket.MulticastSocket(java.net.SocketAddress).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

MulticastSocket(Int32)

Create a multicast socket and bind it to a specific port.

[Android.Runtime.Register(".ctor", "(I)V", "")]
public MulticastSocket (int port);
[<Android.Runtime.Register(".ctor", "(I)V", "")>]
new Java.Net.MulticastSocket : int -> Java.Net.MulticastSocket

Parameters

port
Int32

port to use

Attributes

Exceptions

if an error occurs.

Remarks

Create a multicast socket and bind it to a specific port.

If there is a security manager, its checkListen method is first called with the port argument as its argument to ensure the operation is allowed. This could result in a SecurityException.

When the socket is created the DatagramSocket#setReuseAddress(boolean) method is called to enable the SO_REUSEADDR socket option.

Java documentation for java.net.MulticastSocket.MulticastSocket(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

MulticastSocket(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected MulticastSocket (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Java.Net.MulticastSocket : nativeint * Android.Runtime.JniHandleOwnership -> Java.Net.MulticastSocket

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to