mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-28 22:15:49 -04:00
Hack to choose the last ip which is usually the one that is wanted
This commit is contained in:
@@ -56,7 +56,13 @@ hostAddress(newHostAddress)
|
||||
// The first byte is a letter, resolve it
|
||||
if( (h = gethostbyname(hostAddress.c_str())) != 0)
|
||||
{
|
||||
memcpy(&addr4->sin_addr, h->h_addr_list[0], sizeof(addr4->sin_addr));
|
||||
int i = 0;
|
||||
while (h->h_addr_list[i] != 0) {
|
||||
memcpy(&addr4->sin_addr, h->h_addr_list[i++], sizeof(addr4->sin_addr));
|
||||
//addr4->sin_addr = *(u_long *) h->h_addr_list[i++];
|
||||
//printf("\tIP Address #%d: %s\n", i, inet_ntoa(addr));
|
||||
}
|
||||
//memcpy(&addr4->sin_addr, h->h_addr_list[0], sizeof(addr4->sin_addr));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -22,6 +22,8 @@ struct HN
|
||||
|
||||
HN::HN()
|
||||
{
|
||||
WSADATA wsaData;
|
||||
int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
||||
char name[512] = {"\0"};
|
||||
if(gethostname(name, sizeof(name)) == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user