SocketTaskExtensions.ConnectAsync Método

Definição

Sobrecargas

ConnectAsync(Socket, IPAddress[], Int32, CancellationToken)

Estabelece uma conexão com um host remoto, que é especificado por uma matriz de endereços IP e um número de porta.Establishes a connection to a remote host, which is specified by an array of IP addresses and a port number.

ConnectAsync(Socket, IPAddress, Int32, CancellationToken)

Estabelece uma conexão com um host remoto, que é especificado por um endereço IP e um número de porta.Establishes a connection to a remote host, which is specified by an IP address and a port number.

ConnectAsync(Socket, String, Int32)

Estabelece uma conexão com o host remoto.Establishes a connection to a remote host. O host é especificado por um nome do host e um número da porta.The host is specified by a host name and a port number.

ConnectAsync(Socket, String, Int32, CancellationToken)

Estabelece uma conexão com um host remoto, que é especificado por um nome de host e um número de porta.Establishes a connection to a remote host, which is specified by a host name and a port number.

ConnectAsync(Socket, IPAddress, Int32)

Estabelece uma conexão com o host remoto.Establishes a connection to a remote host. O host é especificado por um endereço IP e um número da porta.The host is specified by an IP address and a port number.

ConnectAsync(Socket, EndPoint, CancellationToken)

Estabelece uma conexão com o host remoto.Establishes a connection to a remote host.

ConnectAsync(Socket, EndPoint)

Estabelece uma conexão com o host remoto.Establishes a connection to a remote host.

ConnectAsync(Socket, IPAddress[], Int32)

Estabelece uma conexão com o host remoto.Establishes a connection to a remote host. O host é especificado por uma matriz de endereços IP e um número da porta.The host is specified by an array of IP addresses and a port number.

ConnectAsync(Socket, IPAddress[], Int32, CancellationToken)

Estabelece uma conexão com um host remoto, que é especificado por uma matriz de endereços IP e um número de porta.Establishes a connection to a remote host, which is specified by an array of IP addresses and a port number.

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

Parâmetros

socket
Socket

O soquete no qual a operação de conexão é executada.The socket that the connect operation is performed on.

addresses
IPAddress[]

Os endereços IP do host remoto.The IP addresses of the remote host.

port
Int32

O número da porta do host remoto.The port number of the remote host.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado para sinalizar que a operação assíncrona deve ser cancelada.A cancellation token that can be used to signal the asynchronous operation should be canceled.

Retornos

ValueTask

Uma tarefa que representa a operação de conexão assíncrona.A task that represents the asynchronous connection operation.

Aplica-se a

ConnectAsync(Socket, IPAddress, Int32, CancellationToken)

Estabelece uma conexão com um host remoto, que é especificado por um endereço IP e um número de porta.Establishes a connection to a remote host, which is specified by an IP address and a port number.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::ValueTask ConnectAsync(System::Net::Sockets::Socket ^ socket, System::Net::IPAddress ^ address, int port, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.ValueTask ConnectAsync (this System.Net.Sockets.Socket socket, System.Net.IPAddress address, int port, System.Threading.CancellationToken cancellationToken);
static member ConnectAsync : System.Net.Sockets.Socket * System.Net.IPAddress * int * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function ConnectAsync (socket As Socket, address As IPAddress, port As Integer, cancellationToken As CancellationToken) As ValueTask

Parâmetros

socket
Socket

O soquete no qual executar a operação de conexão.The socket to perform the connect operation on.

address
IPAddress

O endereço IP do host remoto.The IP address of the remote host.

port
Int32

O número da porta do host remoto.The port number of the remote host.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado para sinalizar que a operação assíncrona deve ser cancelada.A cancellation token that can be used to signal the asynchronous operation should be canceled.

Retornos

ValueTask

Uma tarefa que representa a operação de conexão assíncrona.A task that represents the asynchronous connection operation.

Aplica-se a

ConnectAsync(Socket, String, Int32)

Estabelece uma conexão com o host remoto.Establishes a connection to a remote host. O host é especificado por um nome do host e um número da porta.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
<Extension()>
Public Function ConnectAsync (socket As Socket, host As String, port As Integer) As Task

Parâmetros

socket
Socket

O soquete no qual executar a operação de conexão.The socket to perform the connect operation on.

host
String

O nome do host remoto.The name of the remote host.

port
Int32

O número da porta do host remoto.The port number of the remote host.

Retornos

Task

Uma tarefa assíncrona.An asynchronous task.

Aplica-se a

ConnectAsync(Socket, String, Int32, CancellationToken)

Estabelece uma conexão com um host remoto, que é especificado por um nome de host e um número de porta.Establishes a connection to a remote host, which is specified by a host name and a port number.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::ValueTask ConnectAsync(System::Net::Sockets::Socket ^ socket, System::String ^ host, int port, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.ValueTask ConnectAsync (this System.Net.Sockets.Socket socket, string host, int port, System.Threading.CancellationToken cancellationToken);
static member ConnectAsync : System.Net.Sockets.Socket * string * int * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function ConnectAsync (socket As Socket, host As String, port As Integer, cancellationToken As CancellationToken) As ValueTask

Parâmetros

socket
Socket

O soquete no qual executar a operação de conexão.The socket to perform the connect operation on.

host
String

O nome do host remoto.The name of the remote host.

port
Int32

O número da porta do host remoto.The port number of the remote host.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado para sinalizar que a operação assíncrona deve ser cancelada.A cancellation token that can be used to signal the asynchronous operation should be canceled.

Retornos

ValueTask

Uma tarefa que representa uma operação de conexão assíncrona.A task that represents an asynchronous connection operation.

Aplica-se a

ConnectAsync(Socket, IPAddress, Int32)

Estabelece uma conexão com o host remoto.Establishes a connection to a remote host. O host é especificado por um endereço IP e um número da porta.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
<Extension()>
Public Function ConnectAsync (socket As Socket, address As IPAddress, port As Integer) As Task

Parâmetros

socket
Socket

O soquete no qual executar a operação de conexão.The socket to perform the connect operation on.

address
IPAddress

O endereço IP do host remoto.The IP address of the remote host.

port
Int32

O número da porta do host remoto.The port number of the remote host.

Retornos

Task

Uma tarefa que representa uma operação de conexão assíncrona.A task that represents an asynchronous connection operation.

Aplica-se a

ConnectAsync(Socket, EndPoint, CancellationToken)

Estabelece uma conexão com o host remoto.Establishes a connection to a remote host.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::ValueTask ConnectAsync(System::Net::Sockets::Socket ^ socket, System::Net::EndPoint ^ remoteEP, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.ValueTask ConnectAsync (this System.Net.Sockets.Socket socket, System.Net.EndPoint remoteEP, System.Threading.CancellationToken cancellationToken);
static member ConnectAsync : System.Net.Sockets.Socket * System.Net.EndPoint * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function ConnectAsync (socket As Socket, remoteEP As EndPoint, cancellationToken As CancellationToken) As ValueTask

Parâmetros

socket
Socket

O soquete usado para estabelecer uma conexão.The socket that is used for establishing a connection.

remoteEP
EndPoint

Um EndPoint que representa o dispositivo remoto.An EndPoint that represents the remote device.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado para sinalizar que a operação assíncrona deve ser cancelada.A cancellation token that can be used to signal the asynchronous operation should be canceled.

Retornos

ValueTask

Uma tarefa que representa a operação de conexão assíncrona.A task that represents the asynchronous connection operation.

Aplica-se a

ConnectAsync(Socket, EndPoint)

Estabelece uma conexão com o host remoto.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
<Extension()>
Public Function ConnectAsync (socket As Socket, remoteEP As EndPoint) As Task

Parâmetros

socket
Socket

O soquete usado para estabelecer uma conexão.The socket that is used for establishing a connection.

remoteEP
EndPoint

Um EndPoint que representa o dispositivo remoto.An EndPoint that represents the remote device.

Retornos

Task

Uma tarefa assíncrona.An asynchronous Task.

Aplica-se a

ConnectAsync(Socket, IPAddress[], Int32)

Estabelece uma conexão com o host remoto.Establishes a connection to a remote host. O host é especificado por uma matriz de endereços IP e um número da porta.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
<Extension()>
Public Function ConnectAsync (socket As Socket, addresses As IPAddress(), port As Integer) As Task

Parâmetros

socket
Socket

O soquete no qual a operação de conexão é executada.The socket that the connect operation is performed on.

addresses
IPAddress[]

Os endereços IP do host remoto.The IP addresses of the remote host.

port
Int32

O número da porta do host remoto.The port number of the remote host.

Retornos

Task

Uma tarefa que representa a operação de conexão assíncrona.A task that represents the asynchronous connect operation.

Aplica-se a