public EndReceive ( IAsyncResult asyncResult ) : int | ||
asyncResult | IAsyncResult | Stores state information for this asynchronous operation as well as any user defined data. |
return | int |
/// <summary> /// Handles the end of an asynchronous read. /// </summary> /// <param name="asyncResult">An <see cref="IAsyncResult"/> representing an asynchronous call. </param> /// <returns>The number of bytes read from the stream.</returns> /// <exception cref="ArgumentNullException"><paramref name="asyncResult"/> is a null reference (<b>Nothing</b> in Visual Basic).</exception> /// <exception cref="IOException">There is a failure while reading from the network.</exception> public override int EndRead(IAsyncResult asyncResult) { if (asyncResult == null) { throw new ArgumentNullException(); } if (Socket == null) { throw new IOException(); } try { return(Socket.EndReceive(asyncResult)); } catch (Exception e) { throw new IOException("An I/O exception occurred.", e); } }