SocketTaskExtensions.AcceptAsync Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Surcharges
| Nom | Description |
|---|---|
| AcceptAsync(Socket) |
Effectue une opération asynchrone sur laquelle accepter une tentative de connexion entrante sur le socket. |
| AcceptAsync(Socket, Socket) |
Effectue une opération asynchrone sur laquelle accepter une tentative de connexion entrante sur le socket. |
AcceptAsync(Socket)
Effectue une opération asynchrone sur laquelle accepter une tentative de connexion entrante sur le socket.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<System::Net::Sockets::Socket ^> ^ AcceptAsync(System::Net::Sockets::Socket ^ socket);
public static System.Threading.Tasks.Task<System.Net.Sockets.Socket> AcceptAsync(this System.Net.Sockets.Socket socket);
static member AcceptAsync : System.Net.Sockets.Socket -> System.Threading.Tasks.Task<System.Net.Sockets.Socket>
<Extension()>
Public Function AcceptAsync (socket As Socket) As Task(Of Socket)
Paramètres
- socket
- Socket
Socket qui écoute les connexions.
Retours
Tâche asynchrone qui se termine par un Socket pour gérer la communication avec l’hôte distant.
Exceptions
Une opération non valide a été demandée. Cette exception se produit si l’acceptation Socket n’écoute pas les connexions ou si le socket accepté est lié.
Vous devez appeler la méthode et Bind(EndPoint) la Listen(Int32) méthode avant d’appeler la AcceptAsync(Socket) méthode.
Une erreur s’est produite lors de la tentative d’accès au socket.
Il Socket a été fermé.
S’applique à
AcceptAsync(Socket, Socket)
Effectue une opération asynchrone sur laquelle accepter une tentative de connexion entrante sur le socket.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<System::Net::Sockets::Socket ^> ^ AcceptAsync(System::Net::Sockets::Socket ^ socket, System::Net::Sockets::Socket ^ acceptSocket);
public static System.Threading.Tasks.Task<System.Net.Sockets.Socket> AcceptAsync(this System.Net.Sockets.Socket socket, System.Net.Sockets.Socket acceptSocket);
static member AcceptAsync : System.Net.Sockets.Socket * System.Net.Sockets.Socket -> System.Threading.Tasks.Task<System.Net.Sockets.Socket>
<Extension()>
Public Function AcceptAsync (socket As Socket, acceptSocket As Socket) As Task(Of Socket)
Paramètres
- socket
- Socket
Socket qui écoute les connexions entrantes.
Retours
Tâche asynchrone qui se termine par un Socket pour gérer la communication avec l’hôte distant.
Exceptions
Une opération non valide a été demandée. Cette exception se produit si l’acceptation Socket n’écoute pas les connexions ou si le socket accepté est lié.
Vous devez appeler la méthode et Bind(EndPoint) la Listen(Int32) méthode avant d’appeler la AcceptAsync(Socket, Socket) méthode.
Une erreur s’est produite lors de la tentative d’accès au socket.
Il Socket a été fermé.