#include <Winsock2.h>
#include <stdio.h>
int main(){
DWORD dwBufferLength = 1000;
LPWSAPROTOCOL_INFO lpProtocolBuffer = NULL;
LPDWORD lpdwBufferLength = &dwBufferLength;
WORD wVer;
WSADATA wsaData;
wVer=MAKEWORD(2,2);
if ( WSAStartup(wVer,&wsaData) == SOCKET_ERROR)
{
printf("error number :%d\n",WSAGetLastError());
}
if ( WSAEnumProtocols(NULL,lpProtocolBuffer,lpdwBufferLength) == SOCKET_ERROR )
{
printf("error number : %d \n",WSAGetLastError()); //这里报错,
return 1;
}
return 0;}10055:由于系统缓冲区空间不足或列队已满,不能执行套接字上的操作。
该如何解决呢?
Thanks。
解决方案 »
- 请问,如何使正方形旋转90度?
- 关于delete一个类出错的问题!请大家帮看下这是为什么啊?
- typedef HANDLE EVENTHANDLE 和 #define EVENTHANDLE HANDLE 有何区别??
- CoCreateInstanceEx???
- MDI中如何得到子框架中分割视图的指针?
- 如何用vc生成扩展名为.ax工程?
- 如何用应用程序访问web服务器,向服务器发送数据或从服务器接收数据?
- 为何在对话框的picture control上画图显示不出来?
- 菜菜的问题!
- 闪现FORM上STATIC文本后面有个BMP图,但是文本有个灰背景,若设置为TRASPARENT,STATIC又看不见了
- 五一快乐,啤酒万岁!
- vc制作程序的语言问题
这个可以为空么?
#include <Winsock2.h>
#include <stdio.h>int main(){
DWORD dwBufferLength = 10000; //这里要足够大
LPWSAPROTOCOL_INFO lpProtocolBuffer = (WSAPROTOCOL_INFO *)malloc(sizeof(WSAPROTOCOL_INFO));
LPDWORD lpdwBufferLength = &dwBufferLength;
WORD wVer;
WSADATA wsaData;
wVer=MAKEWORD(2,2);
if ( WSAStartup(wVer,&wsaData) == SOCKET_ERROR)
{
printf("error number :%d\n",WSAGetLastError());
}
if ( WSAEnumProtocols(NULL,lpProtocolBuffer,lpdwBufferLength) == SOCKET_ERROR )
{
printf("error number : %d \n",WSAGetLastError()); //这里报错,
return 1;
}
return 0;}这样就行了,
lpdwBufferLength 要足够大
[in, out] On input, the count of bytes in the lpProtocolBuffer buffer passed to WSAEnumProtocols. On output, the minimum buffer size that can be passed to WSAEnumProtocols to retrieve all the requested information. This routine has no ability to enumerate over multiple calls; the passed-in buffer must be large enough to hold all entries in order for the routine to succeed