SocketChannel.FinishConnect Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Finishes the process of connecting a socket channel.
[Android.Runtime.Register("finishConnect", "()Z", "GetFinishConnectHandler")]
public abstract bool FinishConnect ();
[<Android.Runtime.Register("finishConnect", "()Z", "GetFinishConnectHandler")>]
abstract member FinishConnect : unit -> bool
Returns
true
if, and only if, this channel's socket is now
connected
- Attributes
Exceptions
if the channel is not connected and the connection process has not been initiated.
if this channel is closed.
if this channel is closed by another thread while this method is executing.
if another thread interrupts the calling thread while this operation is in progress. The calling thread has the interrupt state set, and this channel is closed.
if an I/O error occurs.
Remarks
Finishes the process of connecting a socket channel.
A non-blocking connection operation is initiated by placing a socket channel in non-blocking mode and then invoking its #connect connect
method. Once the connection is established, or the attempt has failed, the socket channel will become connectable and this method may be invoked to complete the connection sequence. If the connection operation failed then invoking this method will cause an appropriate java.io.IOException
to be thrown.
If this channel is already connected then this method will not block and will immediately return true
. If this channel is in non-blocking mode then this method will return false
if the connection process is not yet complete. If this channel is in blocking mode then this method will block until the connection either completes or fails, and will always either return true
or throw a checked exception describing the failure.
This method may be invoked at any time. If a read or write operation upon this channel is invoked while an invocation of this method is in progress then that operation will first block until this invocation is complete. If a connection attempt fails, that is, if an invocation of this method throws a checked exception, then the channel will be closed.
Java documentation for java.nio.channels.SocketChannel.finishConnect()
.
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.