Make the address in thing work cross platform.
This commit is contained in:
@@ -540,7 +540,7 @@ void NetworkSyncManager::Update(float fDeltaTime)
|
|||||||
ThisServer.Name = BroadIn.ReadNT();
|
ThisServer.Name = BroadIn.ReadNT();
|
||||||
int port = BroadIn.Read2();
|
int port = BroadIn.Read2();
|
||||||
BroadIn.Read2(); //Num players connected.
|
BroadIn.Read2(); //Num players connected.
|
||||||
unsigned long addy = ntohl(BroadcastReception->fromAddr.sin_addr.S_un.S_addr);
|
unsigned long addy = EzSockets::LongFromAddrIn(BroadcastReception->fromAddr);
|
||||||
ThisServer.Address = ssprintf( "%d.%d.%d.%d:%d",
|
ThisServer.Address = ssprintf( "%d.%d.%d.%d:%d",
|
||||||
(addy<<0)>>24, (addy<<8)>>24, (addy<<16)>>24, (addy<<24)>>24, port );
|
(addy<<0)>>24, (addy<<8)>>24, (addy<<16)>>24, (addy<<24)>>24, port );
|
||||||
|
|
||||||
|
|||||||
@@ -265,6 +265,15 @@ void EzSockets::update()
|
|||||||
pUpdateWrite();
|
pUpdateWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long EzSockets::LongFromAddrIn( const sockaddr_in & s )
|
||||||
|
{
|
||||||
|
#if defined(_XBOX) || defined(_WINDOWS)
|
||||||
|
return ntohl(s.sin_addr.S_un.S_addr);
|
||||||
|
#else
|
||||||
|
return ntohl(s.sin_addr.s_addr);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************\
|
/*********************\
|
||||||
| Raw Data System |
|
| Raw Data System |
|
||||||
|
|||||||
@@ -109,8 +109,10 @@ public:
|
|||||||
skCONNECTED,
|
skCONNECTED,
|
||||||
skERROR
|
skERROR
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sockaddr_in fromAddr;
|
struct sockaddr_in fromAddr;
|
||||||
unsigned long fromAddr_len;
|
unsigned long fromAddr_len;
|
||||||
|
static unsigned long LongFromAddrIn( const sockaddr_in & s );
|
||||||
|
|
||||||
//The following possibly should be private.
|
//The following possibly should be private.
|
||||||
string inBuffer;
|
string inBuffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user