From 783a56ab730861bd2de9cd74be7c6a852d35ec4e Mon Sep 17 00:00:00 2001 From: SoftCoder Date: Thu, 21 Sep 2017 17:23:11 -0700 Subject: [PATCH] - another fix for LAN Search --- source/shared_lib/sources/platform/posix/socket.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index ba2b175c..eb7d8f4b 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -2968,7 +2968,8 @@ void BroadCastSocketThread::execute() { else { printf("NO Addresses found for broadCastAddress using INADDR_ANY\n"); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"NO Addresses found for broadCastAddress using INADDR_ANY\n"); - ipSubnetMaskList.push_back(INADDR_ANY); + //ipSubnetMaskList.push_back(INADDR_ANY); + ipSubnetMaskList.push_back("*"); } port = htons( Socket::getBroadCastPort() ); @@ -2978,7 +2979,12 @@ void BroadCastSocketThread::execute() { // Create the broadcast socket memset( &bcLocal[idx], 0, sizeof( struct sockaddr_in)); bcLocal[idx].sin_family = AF_INET; - bcLocal[idx].sin_addr.s_addr = inet_addr(ipSubnetMaskList[idx].c_str()); //htonl( INADDR_BROADCAST ); + if(ipSubnetMaskList[idx] == "*") { + bcLocal[idx].sin_addr.s_addr = INADDR_ANY; + } + else { + bcLocal[idx].sin_addr.s_addr = inet_addr(ipSubnetMaskList[idx].c_str()); //htonl( INADDR_BROADCAST ); + } bcLocal[idx].sin_port = port; // We are letting the OS fill in the port number for the local machine. #ifdef WIN32 bcfd[idx] = INVALID_SOCKET;