我见了一个client/server,在服务端接收的时候出现这个错误:
由于系统缓冲区空间不足或者队列已满,不能进行套接字上的操作
我接受的代码段时这样的:
DWORD dwResult;
_variant_t vt1, vt2;
LPBYTE pBuffer;
_variant_init( vt1, sizeof( NET_DATA_FOR_INTERNAL));
LPNET_DATA_FOR_INTERNAL pdfi = (LPNET_DATA_FOR_INTERNAL)vt1.parray->pvData;
do
{
::SafeArrayAccessData( vt1.parray, (void**)&pBuffer);
dwResult = RecvBufferUntilComplete( sock, (LPBYTE)pBuffer, vt1.parray->rgsabound->cElements);
::SafeArrayUnaccessData( vt1.parray);
if( dwResult != ERROR_SUCCESS)
break;
_variant_init( vt2, pdfi->dwSize);
if( pdfi->dwSize ) //如果还有数据
{
::SafeArrayAccessData( vt2.parray, (void**)&pBuffer);
dwResult = RecvBufferUntilComplete( sock, pBuffer, pdfi->dwSize);
::SafeArrayUnaccessData( vt2.parray);
if( pdfi->wFormat == NDFI_FORMAT_TEXT)
{
_variant_t vtText = _variant_t((char*)vt2.parray->pvData);
vt2.Clear();
vt2 = vtText;
}
if( dwResult != ERROR_SUCCESS)
break;
}
SAFEARRAY *psa;
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0; //下标
rgsabound[0].cElements = 2; //元素数
psa = SafeArrayCreate(VT_VARIANT, 1, rgsabound);//定义维数
long ix = 0;
SafeArrayPutElement( psa, &ix, &vt1);
ix = 1;
SafeArrayPutElement( psa, &ix, &vt2);
elist.Add( *psa);
}while( pdfi->bIsEnd == FALSE && dwResult == ERROR_SUCCESS);
return dwResult;
请高手帮我看看,那里的问题啊
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课