検索条件
全1件
(1/1ページ)
要:winsock2
INTERFACE_INFO if_list[20]; unsigned long ifsize; if (WSAIoctl(sock, SIO_GET_INTERFACE_LIST, 0, 0, &if_list, sizeof(if_list), &ifsize, 0, 0) == SOCKET_ERROR) throw("Failed Interface List"); int if_num = ifsize / sizeof(INTERFACE_INFO); for (int i=0; i<if_num; i++) { sockaddr_in *adr_ip, *adr_net; adr_ip = (sockaddr_in *)&if_list[i].iiAddress; adr_net = (sockaddr_in *)&if_list[i].iiNetmask; sockaddr.sin_addr.s_addr = adr_ip ->sin_addr.s_addr; sockaddr.sin_addr.s_addr &= adr_net->sin_addr.s_addr; sockaddr.sin_addr.s_addr |= ~(adr_net->sin_addr.s_addr); // strcpy(s,inet_ntoa(sockaddr.sin_addr)); sendto(sock, "Find", 4, 0, (struct sockaddr *)&sockaddr, sizeof(struct sockaddr)); }