Język

ILayeredSocketFactoryExtensions.CreateSocketAsync Method

Definition

Runs the layered socket factory's socket creation operation as a task.

public static System.Threading.Tasks.Task<Java.Net.Socket?> CreateSocketAsync(this Org.Apache.Http.Conn.Schemes.ILayeredSocketFactory self, Java.Net.Socket? socket, string? host, int port, bool autoClose);
static member CreateSocketAsync : Org.Apache.Http.Conn.Schemes.ILayeredSocketFactory * Java.Net.Socket * string * int * bool -> System.Threading.Tasks.Task<Java.Net.Socket>

Parameters

self
ILayeredSocketFactory

The layered socket factory on which to call CreateSocket(Socket, String, Int32, Boolean).

socket
Socket

The existing socket over which to create the new socket.

host
String

The name or IP address of the remote host.

port
Int32

The port number on the remote host.

autoClose
Boolean

true to close socket when the new socket is closed; otherwise, false.

Returns

A task whose result is the new socket returned by self.CreateSocket(socket, host, port, autoClose), connected to the specified host and layered over socket.

Remarks

This .NET extension method uses System.Threading.Tasks.Task.Run to call the synchronous CreateSocket(Socket, String, Int32, Boolean) method on self. It does not use native asynchronous socket I/O and has no cancellation token parameter. Exceptions from the synchronous call are stored in the returned task.

For the generated implementation, see the .NET for Android async extension generator.

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