当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > C#下Socket对象的BeginReceive方法,执行后竟然不调用AsyncCallback里的回调函数

ASP.NET
Web服务器控件:LinkButton控件
Web服务器控件:ListBox控件
Web服务器控件:ListItem控件
Web服务器控件:Literal控件
Web服务器控件:Panel控件
Web服务器控件:PlaceHolder控件
Web服务器控件:RadioButton控件
Web服务器控件:RadioButtonList控件
Web服务器控件:BulletedList控件
Web服务器控件:Style控件
Web服务器控件:Table控件
Web服务器控件:TableCell控件
Web服务器控件:TableRow控件
Web服务器控件:TextBox控件
Web服务器控件:XML控件
Validation服务器控件:CompareValidator控件
Validation服务器控件:CustomValidator控件
Validation服务器控件:RangeValidator控件
Validation服务器控件:RegularExpressionValidator控件
Validation服务器控件:RequiredFieldValidator控件

ASP.NET 中的 C#下Socket对象的BeginReceive方法,执行后竟然不调用AsyncCallback里的回调函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 166 ::
收藏到网摘: n/a


到底是怎么回事?仅仅发生在我的机器上,修改了ip配置后放到别的机器上是没有任何问题的,可以很好的回调。难道我的机器有何异常?请教高手了!
某一线程下socket对象user.sock开始执行BeginReceive语句:
user.sock.BeginReceive(user.buffer,0,User.BufferSize,0,new System.AsyncCallback(DoRecevive),user);

对应的回调函数:
public static void DoRecevive(IAsyncResult ar)
{
Console.WriteLine("Begin Receive Date, Waiting for the Call Back");
//...
}
在我的机器上BeginReceive之后不执行DoRecevive函数,在别的机器上可以很好的执行该函数并且
打出“Begin Receive Date, Waiting for the Call Back”字符串