Socket.EndReceiveMessageFrom Metodo

Definizione

Termina una lettura asincrona in sospeso da uno specifico endpoint. Questo metodo fornisce inoltre ulteriori informazioni sul pacchetto rispetto a EndReceiveFrom(IAsyncResult, EndPoint).

public:
 int EndReceiveMessageFrom(IAsyncResult ^ asyncResult, System::Net::Sockets::SocketFlags % socketFlags, System::Net::EndPoint ^ % endPoint, [Runtime::InteropServices::Out] System::Net::Sockets::IPPacketInformation % ipPacketInformation);
public int EndReceiveMessageFrom (IAsyncResult asyncResult, ref System.Net.Sockets.SocketFlags socketFlags, ref System.Net.EndPoint endPoint, out System.Net.Sockets.IPPacketInformation ipPacketInformation);
member this.EndReceiveMessageFrom : IAsyncResult * SocketFlags * EndPoint * IPPacketInformation -> int
Public Function EndReceiveMessageFrom (asyncResult As IAsyncResult, ByRef socketFlags As SocketFlags, ByRef endPoint As EndPoint, ByRef ipPacketInformation As IPPacketInformation) As Integer

Parametri

asyncResult
IAsyncResult

Oggetto IAsyncResult che memorizza informazioni sullo stato e qualsiasi dato definito dall'utente per l'operazione asincrona.

socketFlags
SocketFlags

Combinazione bit per bit dei valori di SocketFlags relativi al pacchetto ricevuto.

endPoint
EndPoint

Il EndPoint di origine.

ipPacketInformation
IPPacketInformation

L'IPAddress e l'interfaccia del pacchetto ricevuto.

Restituisce

Int32

Se ha esito positivo, numero di byte ricevuti. Se ha esito negativo restituisce 0.

Eccezioni

asyncResult è null

-oppure-

endPoint è null.

Si è verificato un errore durante il tentativo di accesso al socket.

L'oggetto Socket è stato chiuso.

Commenti

Se l'operazione non è stata completata, questo metodo blocca fino a quando non viene eseguito.

Per eseguire questa operazione in modo sincrono, usare il ReceiveMessageFrom metodo .

Esaminare ipPacketInformation se è necessario sapere se il datagram è stato inviato usando un indirizzo unicast, multicast o broadcast.

Si applica a