标题:异步接收程序的问题!
取消只看楼主
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-101135-1-1.html




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

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