bind的时候出问题,错误码是 10049
bind的时候出问题,错误码是 10049 哪位大哥给个原因 void SendFile(void) { SOCKET s; CSrchDir sd; ifstream fin; struct sockaddr_in name;//={INADDR_ANY, PORT, AF_INET}; char path[MAX_PATH],databuf[LENGTH]; int n,i; WSADATA wsd; WORD wVersionRequested=MAKEWORD(2,2); char sip[16];
name.sin_family=AF_INET; name.sin_port=PORT;
cout<<"input embracer's IP :\n "; cin>>sip; name.sin_addr.s_addr=inet_addr(sip);
if(WSAStartup(wVersionRequested, &wsd)!=0) return;
s = socket(AF_INET, SOCK_STREAM, 0);
if(bind(s, (struct sockaddr*)&name, sizeof(struct sockaddr))!=0){ i=WSAGetLastError(); cout<<i<<endl; return; }
if(connect(s, (struct sockaddr*)&name, sizeof(struct sockaddr))!=0) return; ……