Java.Nio.Channels.SocketChannel.Connect Method
Connects this channel's socket with a remote address.

Syntax

[Android.Runtime.Register("connect", "(Ljava/net/SocketAddress;)Z", "GetConnect_Ljava_net_SocketAddress_Handler")]
public abstract bool Connect (Java.Net.SocketAddress address)

Parameters

address
the address to connect with.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Nio.Channels.AlreadyConnectedExceptionif the channel is already connected.
Java.Nio.Channels.ConnectionPendingExceptiona non-blocking connecting operation is already executing on this channel.
Java.Nio.Channels.ClosedChannelExceptionif this channel is closed.
Java.Nio.Channels.AsynchronousCloseExceptionif this channel is closed by another thread while this method is executing.
Java.Nio.Channels.ClosedByInterruptExceptionif another thread interrupts the calling thread while this operation is in progress. The calling thread will have the interrupt state set and this channel will be closed.
Java.Nio.Channels.UnresolvedAddressExceptionif the address is not resolved.
Java.Nio.Channels.UnsupportedAddressTypeExceptionif the address type is not supported.
Java.IO.IOExceptionif an I/O error occurs.

Remarks

Connects this channel's socket with a remote address.

If this channel is blocking, this method will suspend until connecting is finished or an I/O exception occurs. If the channel is non-blocking, this method will return true if the connection is finished at once or return false when the connection must be finished later by calling finishConnect().

This method can be called at any moment and can block other read and write operations while connecting. It executes the same security checks as the connect method of the Socket class.

[Android Documentation]

Requirements

Namespace: Java.Nio.Channels
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1