【发布时间】:2011-07-08 16:12:30
【问题描述】:
换句话说,在委托执行开始之间收到的新数据包会发生什么:
public static void Read_Callback(IAsyncResult ar){
StateObject so = (StateObject) ar.AsyncState;
Socket s = so.workSocket;
int read = s.EndReceive(ar);
if (read > 0) {
so.sb.Append(Encoding.ASCII.GetString(so.buffer, 0, read));
然后下一次调用该套接字上的 beginReceive?
s.BeginReceive(so.buffer, 0, StateObject.BUFFER_SIZE, 0,
new AsyncCallback(Async_Send_Receive.Read_Callback), so);
}
是并行执行第二个 onDataReceived,还是数据在缓冲区中排队,下一个 beginReceive 在被调用后立即触发委托?
【问题讨论】: