13 namespace WinampRemote
19 bool GetIPAddress(std::string&
const HostName, std::string &ResolvedName,
20 vector<std::string> &Addresses,
21 vector<std::string> &Aliases)
25 const hostent * hent = NULL;
27 WORD wVersionRequested = MAKEWORD(2, 2);
30 err = WSAStartup(wVersionRequested, &wsaData);
33 hent = gethostbyname(HostName.c_str());
44 while ( (LPIN_ADDR)hent->h_addr_list[i] != NULL)
46 addr.S_un.S_addr = ( (LPIN_ADDR)hent->h_addr_list[i] )->s_addr;
47 Addresses.push_back(inet_ntoa( addr ));
53 while ( (
char *)hent->h_aliases[i] != NULL)
55 Aliases.push_back(hent->h_aliases[i]);
59 ResolvedName = hent->h_name;
87 m_hostname(hostname), m_resolved(),
88 m_addresses(), m_aliases()
92 GetIPAddress(m_hostname, m_resolved, m_addresses, m_aliases);