| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 808 人关注过本帖
标题:异步接收程序的问题!
取消只看楼主 加入收藏
luochen601
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2006-10-23
收藏
 问题点数:0 回复次数:0 
异步接收程序的问题!
public UserClient(TcpClient client) //UserClient的构造函数
{
this._client = client;
ns = _client.GetStream();
ns.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(streamReceive),null );
}
private void streamReceive(IAsyncResult ar) //回调函数
{
int BytesRead;
byte[] rcv;
BytesRead =ns.EndRead (ar);
if(BytesRead !=0)
{
rcv=new byte [BytesRead -1];
for (int i = 0; i < BytesRead; i++)
{
rcv[i] = buffer[i];
}
ns.BeginRead (buffer ,0,buffer.Length ,new AsyncCallback (streamReceive ),null );
}
}
这个程序有什么问题?为什么接收不了呢?
搜索更多相关主题的帖子: 异步 client BytesRead buffer 
2006-11-06 18:44
快速回复:异步接收程序的问题!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013043 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved