日期:2014-05-17 浏览次数:20989 次
private void beginReadStatus()
{
receiveDataBuffer = null;
receiveDataBuffer = new Byte[this.tcpclient.ReceiveBufferSize];
tcpstream.BeginRead(receiveDataBuffer, 0, receiveDataBuffer.Length, new AsyncCallback(doReadStatus), tcpstream);
}
private void doReadStatus(IAsyncResult ar)
{
Stream stream = (Stream)ar.AsyncState;
if (stream.CanRead)
{
int dataSize = tcpstream.EndRead(ar);
……(业务代码)
tcpstream.BeginRead(receiveDataBuffer, 0, receiveDataBuffer.Length, new AsyncCallback(doReadStatus), tcpstream);
}
}