mirror of
https://github.com/glest/glest-source.git
synced 2025-08-14 04:13:58 +02:00
- fix find lan games by extra NIC search
This commit is contained in:
@@ -702,6 +702,29 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
|
|||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
||||||
// Now check all linux network devices
|
// Now check all linux network devices
|
||||||
|
|
||||||
|
struct ifaddrs *ifap, *ifa;
|
||||||
|
struct sockaddr_in *sa;
|
||||||
|
char *addr;
|
||||||
|
|
||||||
|
getifaddrs (&ifap);
|
||||||
|
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
|
||||||
|
if (ifa->ifa_addr->sa_family==AF_INET) {
|
||||||
|
sa = (struct sockaddr_in *) ifa->ifa_addr;
|
||||||
|
addr = inet_ntoa(sa->sin_addr);
|
||||||
|
//printf("Interface: %s\tAddress: %s\n", ifa->ifa_name, addr);
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] Interface: %s\tAddress: %s\n",__FILE__,__FUNCTION__,__LINE__,addr);
|
||||||
|
if(strlen(addr) > 0 &&
|
||||||
|
strncmp(addr,"127.",4) != 0 &&
|
||||||
|
strncmp(addr,"0.",2) != 0) {
|
||||||
|
if(std::find(ipList.begin(),ipList.end(),addr) == ipList.end()) {
|
||||||
|
ipList.push_back(addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
freeifaddrs(ifap);
|
||||||
|
|
||||||
//std::vector<string> intfTypes;
|
//std::vector<string> intfTypes;
|
||||||
if(Socket::intfTypes.empty()) {
|
if(Socket::intfTypes.empty()) {
|
||||||
Socket::intfTypes.push_back("lo");
|
Socket::intfTypes.push_back("lo");
|
||||||
|
Reference in New Issue
Block a user