Adapted getLocalAddresses() includes for windows

This commit is contained in:
Gio 2015-12-01 23:38:44 +01:00
parent 5a541e7feb
commit 1b2fa3600a

View File

@ -296,8 +296,14 @@ in_addr_t inet_network(const char *inet_name)
#include <sys/types.h>
#ifdef WINDOWS_SYS
#include <winsock2.h>
#include <iphlpapi.h>
#pragma comment(lib, "IPHLPAPI.lib")
#else // WINDOWS_SYS
#include <ifaddrs.h>
#include <net/if.h>
#endif // WINDOWS_SYS
void getLocalAddressesFailed()
{
@ -332,7 +338,7 @@ bool getLocalAddresses(std::list<sockaddr_storage> & addrs)
{
sockaddr_storage * tmp = new sockaddr_storage;
sockaddr_storage_clear(*tmp);
if (sockaddr_storage_copyip(* tmp, * reinterpret_cast<sockaddr_storage*>(address->Address.lpSockaddr))
if (sockaddr_storage_copyip(* tmp, * reinterpret_cast<sockaddr_storage*>(address->Address.lpSockaddr)))
addrs.push_back(*tmp);
else delete tmp;
}