SocketTaskExtensions.ConnectAsync Method

Definition

Overloads

ConnectAsync(Socket, EndPoint)

Establishes a connection to a remote host.

ConnectAsync(Socket, IPAddress, Int32)

Establishes a connection to a remote host. The host is specified by an IP address and a port number.

ConnectAsync(Socket, IPAddress[], Int32)

Establishes a connection to a remote host. The host is specified by an array of IP addresses and a port number.

ConnectAsync(Socket, String, Int32)

Establishes a connection to a remote host. The host is specified by a host name and a port number.

ConnectAsync(Socket, EndPoint)

Establishes a connection to a remote host.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task ^ ConnectAsync(System::Net::Sockets::Socket ^ socket, System::Net::EndPoint ^ remoteEP);
public static System.Threading.Tasks.Task ConnectAsync (this System.Net.Sockets.Socket socket, System.Net.EndPoint remoteEP);
static member ConnectAsync : System.Net.Sockets.Socket * System.Net.EndPoint -> System.Threading.Tasks.Task

Parameters

socket
Socket

The socket that is used for establishing a connection.

remoteEP
EndPoint

An EndPoint that represents the remote device.

Returns

An asynchronous Task.

ConnectAsync(Socket, IPAddress, Int32)

Establishes a connection to a remote host. The host is specified by an IP address and a port number.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task ^ ConnectAsync(System::Net::Sockets::Socket ^ socket, System::Net::IPAddress ^ address, int port);
public static System.Threading.Tasks.Task ConnectAsync (this System.Net.Sockets.Socket socket, System.Net.IPAddress address, int port);
static member ConnectAsync : System.Net.Sockets.Socket * System.Net.IPAddress * int -> System.Threading.Tasks.Task

Parameters

socket
Socket

The socket to perform the connect operation on.

address
IPAddress

The IP address of the remote host.

port
Int32

The port number of the remote host.

Returns

ConnectAsync(Socket, IPAddress[], Int32)

Establishes a connection to a remote host. The host is specified by an array of IP addresses and a port number.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task ^ ConnectAsync(System::Net::Sockets::Socket ^ socket, cli::array <System::Net::IPAddress ^> ^ addresses, int port);
public static System.Threading.Tasks.Task ConnectAsync (this System.Net.Sockets.Socket socket, System.Net.IPAddress[] addresses, int port);
static member ConnectAsync : System.Net.Sockets.Socket * System.Net.IPAddress[] * int -> System.Threading.Tasks.Task

Parameters

socket
Socket

The socket that the connect operation is performed on.

addresses
IPAddress[]

The IP addresses of the remote host.

port
Int32

The port number of the remote host.

Returns

A task that represents the asynchronous connect operation.

ConnectAsync(Socket, String, Int32)

Establishes a connection to a remote host. The host is specified by a host name and a port number.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task ^ ConnectAsync(System::Net::Sockets::Socket ^ socket, System::String ^ host, int port);
public static System.Threading.Tasks.Task ConnectAsync (this System.Net.Sockets.Socket socket, string host, int port);
static member ConnectAsync : System.Net.Sockets.Socket * string * int -> System.Threading.Tasks.Task

Parameters

socket
Socket

The socket to perform the connect operation on.

host
String

The name of the remote host.

port
Int32

The port number of the remote host.

Returns

An asynchronous task.

Applies to