ReturnValue

8楼  ying8959   ( 阿因) 一级用户 该版得分小于等于100分  回复于  2005-04-07 18:45:52  得分 0

前一段我用APS.NET作了一个基于拉技术的聊天室,后来想在其中增加点游戏内容,感觉到基于拉技术的响应实时性不好,所以想改为基于拉技术的。  
          现已作了尝试,代码如下:  
   
  //   Content.aspx.cs   ///  
  public   class   Content   :   System.Web.UI.Page  
  {  
  private   void   Page_Load(object   sender,   System.EventArgs   e)  
  {  
  Session.Timeout   =   60;  
  Response.Write("欢迎   .   .   .<br>/n");  
  Response.Flush();  
  Application[Session.SessionID]   =   Response;  
  System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);  
  }  
  }  
   
   
  //   Send.aspx.cs   //  
  public   class   Send   :   System.Web.UI.Page  
  {  
  protected   System.Web.UI.WebControls.Button   ButtonSend;  
  protected   System.Web.UI.WebControls.TextBox   TextBox1;  
   
  private   void   ButtonSend_Click(object   sender,   System.EventArgs   e)  
  {  
  foreach(string   name   in   Application.AllKeys)  
  {  
  HttpResponse   Response   =   Application[name]   as   HttpResponse;  
  if(Response!=null   &&   Response.IsClientConnected)  
  {  
  Response.Write(TextBox1.Text   +   "<br>/n");  
  Response.Flush();  
  }  
  else  
  {  
  Application.Remove(name);  
  }  
  }  
  }  
  }  
   
          可以聊天,但发现一大问题:同时连接的用户被限制在50个左右,再多的就连不上了,并且会导致其他用户也陷于停滞状态。  
          请高手答疑解惑,还可另开贴给分!
Top
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值