MFC中的数据丢失 [英] Dataloss in mfc

查看:103
本文介绍了MFC中的数据丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在从服务器/客户端接收值时遇到问题.在AsyncSocket::Receive函数中.
我正在使用TCHAR *pbuff=new TCHAR[4096];
同时收到pBuff.我只能得到前3个字符.
帮助我

I am having the problem in receiving values from the server/client. In the AsyncSocket::Receive function.
I am using the TCHAR *pbuff=new TCHAR[4096];
while receiving in pBuff. I can get only the first 3 characters.
Help me

推荐答案

您好

看看 [
Hi

Have a look on this[^] might be help


您多少发送 ? :)您的问题不够清楚,无法理解问题.请发布更多详细信息.
how much you send ? :) Your question is not clear enough to understand the problem. please post more details.


我已经解决了这个问题.代码如下::谢谢..的合作...
I have solved the problem... the code is below:: thank you.. for your cooperation...
void CServerClass::OnReceive()
{
	WCHAR *pBuff=new WCHAR[100];
	int iBuffSize=99;
	int Rcvd;
	CAsyncSocket rr;

	
	Rcvd = m_client.Receive(pBuff,100);
	if(Rcvd==SOCKET_ERROR)
	{ 
	}
	else											
	{
		pBuff[Rcvd]=NULL;
		CString lvstrRecev(pBuff);
		int nLength;
		nLength = lvstrRecev.GetLength();
		CString strTemp;
		for(int i=0;i<nLength/2;i++)
		{
			strTemp += lvstrRecev.GetAt(i);
		}
		m_lrecv.AddString(strTemp);
		UpdateData(FALSE);

	}
}


这篇关于MFC中的数据丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆