Stream.EndRead(IAsyncResult) 메서드
정의
보류 중인 비동기 읽기가 완료되기를 기다립니다.Waits for the pending asynchronous read to complete. 대신 ReadAsync(Byte[], Int32, Int32)를 사용하세요.(Consider using ReadAsync(Byte[], Int32, Int32) instead.)
public:
virtual int EndRead(IAsyncResult ^ asyncResult);
public virtual int EndRead (IAsyncResult asyncResult);
abstract member EndRead : IAsyncResult -> int
override this.EndRead : IAsyncResult -> int
Public Overridable Function EndRead (asyncResult As IAsyncResult) As Integer
매개 변수
- asyncResult
- IAsyncResult
완료할 보류 중인 비동기 요청에 대한 참조입니다.The reference to the pending asynchronous request to finish.
반환
0과 요청한 바이트 수 사이의 스트림에서 읽은 바이트 수입니다.The number of bytes read from the stream, between zero (0) and the number of bytes you requested. 스트림은 스트림의 끝에서만 0을 반환하며, 그렇지 않으면 사용할 수 있는 바이트가 1바이트 이상이 될 때까지 차단됩니다.Streams return zero (0) only at the end of the stream, otherwise, they should block until at least one byte is available.
예외
asyncResult
이(가) null
인 경우asyncResult
is null
.
보류 중인 읽기 작업에 대한 핸들을 사용할 수 없는 경우A handle to the pending read operation is not available.
또는-or-
보류 중인 작업이 읽기를 지원하지 않는 경우The pending operation does not support reading.
asyncResult
가 현재 스트림의 BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) 메서드에서 시작되지 않았습니다.asyncResult
did not originate from a BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) method on the current stream.
스트림이 닫혔거나 내부 오류가 발생했습니다.The stream is closed or an internal error has occurred.
설명
.NET Framework 4 및 이전 버전에서 비동기 I/O 작업을 구현하려면 BeginRead 및 EndRead와 같은 메서드를 사용해야 합니다.In the .NET Framework 4 and earlier versions, you have to use methods such as BeginRead and EndRead to implement asynchronous I/O operations. 이러한 메서드는 여전히에서 사용 하 여 레거시 코드를 지원할 수 있지만,,, 등의 .NET Framework 4.5.NET Framework 4.5 새로운 비동기 메서드는 ReadAsync WriteAsync CopyToAsync FlushAsync 비동기 i/o 작업을 보다 쉽게 구현 하는 데 도움이 됩니다.These methods are still available in the .NET Framework 4.5.NET Framework 4.5 to support legacy code; however, the new async methods, such as ReadAsync, WriteAsync, CopyToAsync, and FlushAsync, help you implement asynchronous I/O operations more easily.
EndRead
을 호출 하 여 스트림에서 읽은 바이트 수를 확인 합니다.Call EndRead
to determine how many bytes were read from the stream.
EndRead
는의 모든에서 한 번만 호출할 수 있습니다 IAsyncResult BeginRead .EndRead
can be called once on every IAsyncResult from BeginRead.
이 메서드는 I/O 작업이 완료될 때까지 차단됩니다.This method blocks until the I/O operation has completed.