2013-04-28 29 views

回答

0

您将网络流本身作为“状态”参数传递。

在回调中,您提取网络流从“AR”参数回来,然后调用EndRead():

Dim stream As NetworkStream = CType(ar.AsyncState, NetworkStream) 
Dim bytesRead As Integer = stream.EndRead(ar) 

您的数据将是您在的BeginRead规定后缓冲器()调用。使用“bytesRead”知道有多少缓冲区中有数据。