一个网络编程问题
.......
SOCKET s; s=socket(AF_INET,SOCK_RAW,IPPROTO_RAW); if(s==INVALID_SOCKET) { cout <<"socket error!" <<endl; exit(1); } int optval=1; int k=setsockopt(s,IPPROTO_IP,IP_HDRINCL,(char *)&optval,sizeof(optval)); if(k==SOCKET_ERROR) { cout <<"setsockopt error" <<endl; k=WSAGetLastError(); cout <<k <<endl; exit(1); } SOCKADDR_IN laddr; laddr.sin_family=AF_INET; laddr.sin_addr.s_addr=inet_addr("192.168.2.103");//我的网卡的IP为"192.168.2.103" laddr.sin_port=htons(0); k=bind(s,(SOCKADDR*)&laddr,sizeof(laddr)); if(k==SOCKET_ERROR) { cout <<"bind error" <<endl; k=WSAGetLastError(); cout <<k <<endl; exit(1); }
.......
在bind的时候就出错了,出错代码是10049
请问一下这是怎么回事啊,小弟不胜感激..