下你所需,载你所想!
汇集开发技术源码资料

socket通讯(客户端接收服务端数据)

:670.068KB :1 :2022-10-09 16:12:28

部分简介

socket通讯(客户端接收服务端数据)如果开发者对于本文件有需要的可以参考。
客户端socket
int CClient::ReceiveData()
{
if (m_hSocket == INVALID_SOCKET)
return -1;
//stru_TestData dataFrame;
//memset(&dataFrame,0,sizeof(stru_TestData));
//_DATA dataFrame;
_PACKET dataFrame;
memset(&dataFrame, 0, sizeof(_PACKET));
int nResult = recv(m_hSocket, (char*)&dataFrame, sizeof(_PACKET), 0);
std::cout << "The data RECV:" << dataFrame.title
<< dataFrame.MW35.type << dataFrame.MW35.number << dataFrame.MW35.value
<< dataFrame.M34.type << dataFrame.M34.number << dataFrame.M34.value
<< dataFrame.M45.type << dataFrame.M45.number << dataFrame.M45.value
<< dataFrame.M215.type << dataFrame.M215.number << dataFrame.M215.value
<< dataFrame.end << "\n";
if (nResult != sizeof(_PACKET))
return -1;
return 0;
}

socket通讯(客户端接收服务端数据)

热门推荐

相关文章