cSocket: final localhost fix - made it a function
git-svn-id: http://mc-server.googlecode.com/svn/trunk@242 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
5c8d7a75bf
commit
21f758c9c0
@ -16,12 +16,6 @@
|
||||
|
||||
|
||||
|
||||
unsigned long cSocket::INTERNET_ADDRESS_LOCALHOST = 127; // TODO: Linux won't accept this: htonl((127 << 24) | 1);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cSocket::cSocket(xSocket a_Socket)
|
||||
: m_Socket(a_Socket)
|
||||
{
|
||||
@ -195,6 +189,20 @@ cSocket cSocket::CreateSocket()
|
||||
|
||||
|
||||
|
||||
unsigned long cSocket::INTERNET_ADDRESS_LOCALHOST(void)
|
||||
{
|
||||
static unsigned long LocalHost = 0;
|
||||
if (LocalHost == 0)
|
||||
{
|
||||
LocalHost = inet_addr("127.0.0.1"); // GCC won't accept this as a global var assignment
|
||||
}
|
||||
return LocalHost;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int cSocket::Bind(SockAddr_In& a_Address)
|
||||
{
|
||||
sockaddr_in local;
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
|
||||
static const short ADDRESS_FAMILY_INTERNET = 2;
|
||||
static const unsigned long INTERNET_ADDRESS_ANY = 0;
|
||||
static unsigned long INTERNET_ADDRESS_LOCALHOST; // 127.0.0.1 represented in network byteorder
|
||||
static unsigned long INTERNET_ADDRESS_LOCALHOST(void); // 127.0.0.1 represented in network byteorder; must be a function due to GCC :(
|
||||
|
||||
int Bind( SockAddr_In& a_Address );
|
||||
int Listen( int a_Backlog );
|
||||
|
Loading…
x
Reference in New Issue
Block a user