AsynchronousSocketChannel.Connect Method

Definition

Overloads

Connect(SocketAddress)

Connects this channel.

Connect(SocketAddress, Object, ICompletionHandler)

Connects this channel.

Connect(SocketAddress)

Connects this channel.

[Android.Runtime.Register("connect", "(Ljava/net/SocketAddress;)Ljava/util/concurrent/Future;", "GetConnect_Ljava_net_SocketAddress_Handler", ApiSince=26)]
public abstract Java.Util.Concurrent.IFuture? Connect (Java.Net.SocketAddress? remote);
[<Android.Runtime.Register("connect", "(Ljava/net/SocketAddress;)Ljava/util/concurrent/Future;", "GetConnect_Ljava_net_SocketAddress_Handler", ApiSince=26)>]
abstract member Connect : Java.Net.SocketAddress -> Java.Util.Concurrent.IFuture

Parameters

remote
SocketAddress

The remote address to which this channel is to be connected

Returns

A Future object representing the pending result

Attributes

Remarks

Connects this channel.

This method initiates an operation to connect this channel. This method behaves in exactly the same manner as the #connect(SocketAddress, Object, CompletionHandler) method except that instead of specifying a completion handler, this method returns a Future representing the pending result. The Future's Future#get() get method returns null on successful completion.

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

Connect(SocketAddress, Object, ICompletionHandler)

Connects this channel.

[Android.Runtime.Register("connect", "(Ljava/net/SocketAddress;Ljava/lang/Object;Ljava/nio/channels/CompletionHandler;)V", "GetConnect_Ljava_net_SocketAddress_Ljava_lang_Object_Ljava_nio_channels_CompletionHandler_Handler", ApiSince=26)]
[Java.Interop.JavaTypeParameters(new System.String[] { "A" })]
public abstract void Connect (Java.Net.SocketAddress? remote, Java.Lang.Object? attachment, Java.Nio.Channels.ICompletionHandler? handler);
[<Android.Runtime.Register("connect", "(Ljava/net/SocketAddress;Ljava/lang/Object;Ljava/nio/channels/CompletionHandler;)V", "GetConnect_Ljava_net_SocketAddress_Ljava_lang_Object_Ljava_nio_channels_CompletionHandler_Handler", ApiSince=26)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "A" })>]
abstract member Connect : Java.Net.SocketAddress * Java.Lang.Object * Java.Nio.Channels.ICompletionHandler -> unit

Parameters

remote
SocketAddress

The remote address to which this channel is to be connected

attachment
Object

The object to attach to the I/O operation; can be null

handler
ICompletionHandler

The handler for consuming the result

Attributes

Remarks

Connects this channel.

This method initiates an operation to connect this channel. The handler parameter is a completion handler that is invoked when the connection is successfully established or connection cannot be established. If the connection cannot be established then the channel is closed.

This method performs exactly the same security checks as the java.net.Socket class. That is, if a security manager has been installed then this method verifies that its java.lang.SecurityManager#checkConnect checkConnect method permits connecting to the address and port number of the given remote endpoint.

Java documentation for java.nio.channels.AsynchronousSocketChannel.connect(java.net.SocketAddress, A, java.nio.channels.CompletionHandler<java.lang.Void, ? super A>).

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