SocketChannel.Open Method

Definition

Overloads

Open()

Opens a socket channel.

Open(SocketAddress)

Opens a socket channel and connects it to a remote address.

Open()

Opens a socket channel.

[Android.Runtime.Register("open", "()Ljava/nio/channels/SocketChannel;", "")]
public static Java.Nio.Channels.SocketChannel? Open ();
[<Android.Runtime.Register("open", "()Ljava/nio/channels/SocketChannel;", "")>]
static member Open : unit -> Java.Nio.Channels.SocketChannel

Returns

A new socket channel

Attributes

Exceptions

if an I/O error occurs.

Remarks

Opens a socket channel.

The new channel is created by invoking the java.nio.channels.spi.SelectorProvider#openSocketChannel openSocketChannel method of the system-wide default java.nio.channels.spi.SelectorProvider object.

Java documentation for java.nio.channels.SocketChannel.open().

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

Open(SocketAddress)

Opens a socket channel and connects it to a remote address.

[Android.Runtime.Register("open", "(Ljava/net/SocketAddress;)Ljava/nio/channels/SocketChannel;", "")]
public static Java.Nio.Channels.SocketChannel? Open (Java.Net.SocketAddress? remote);
[<Android.Runtime.Register("open", "(Ljava/net/SocketAddress;)Ljava/nio/channels/SocketChannel;", "")>]
static member Open : Java.Net.SocketAddress -> Java.Nio.Channels.SocketChannel

Parameters

remote
SocketAddress

The remote address to which the new channel is to be connected

Returns

A new, and connected, socket channel

Attributes

Exceptions

if this channel is closed by another thread while this method is executing.

if another thread interrupts the calling thread while this operation is executing. The calling thread will have the interrupt state set and the channel will be closed.

if the address is not resolved.

if the address type is not supported.

if an I/O error occurs.

Remarks

Opens a socket channel and connects it to a remote address.

This convenience method works as if by invoking the #open() method, invoking the #connect(SocketAddress) connect method upon the resulting socket channel, passing it remote, and then returning that channel.

Java documentation for java.nio.channels.SocketChannel.open(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