summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-15 22:24:22 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-15 22:24:22 +0200
commit360c579105a2acf2b9a14ab5a8c7b019404ad5e8 (patch)
tree2bf5b021517b7581781c20fbb37c7da4df55ba43
parentFixed compilation on linux. (diff)
downloadcuberite-360c579105a2acf2b9a14ab5a8c7b019404ad5e8.tar
cuberite-360c579105a2acf2b9a14ab5a8c7b019404ad5e8.tar.gz
cuberite-360c579105a2acf2b9a14ab5a8c7b019404ad5e8.tar.bz2
cuberite-360c579105a2acf2b9a14ab5a8c7b019404ad5e8.tar.lz
cuberite-360c579105a2acf2b9a14ab5a8c7b019404ad5e8.tar.xz
cuberite-360c579105a2acf2b9a14ab5a8c7b019404ad5e8.tar.zst
cuberite-360c579105a2acf2b9a14ab5a8c7b019404ad5e8.zip
Diffstat (limited to '')
-rw-r--r--source/OSSupport/Socket.cpp18
-rw-r--r--source/OSSupport/Socket.h1
2 files changed, 2 insertions, 17 deletions
diff --git a/source/OSSupport/Socket.cpp b/source/OSSupport/Socket.cpp
index 48bfc6cfd..f79bdbf47 100644
--- a/source/OSSupport/Socket.cpp
+++ b/source/OSSupport/Socket.cpp
@@ -193,20 +193,6 @@ cSocket cSocket::CreateSocket(eFamily a_Family)
-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;
-}
-
-
-
-
-
bool cSocket::BindToAnyIPv4(unsigned short a_Port)
{
sockaddr_in local;
@@ -246,7 +232,7 @@ bool cSocket::BindToLocalhostIPv4(unsigned short a_Port)
memset(&local, 0, sizeof(local));
local.sin_family = AF_INET;;
- local.sin_addr.s_addr = INTERNET_ADDRESS_LOCALHOST();
+ local.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
local.sin_port = htons((u_short)a_Port);
return (bind(m_Socket, (sockaddr*)&local, sizeof(local)) == 0);
@@ -337,7 +323,7 @@ bool cSocket::ConnectToLocalhostIPv4(unsigned short a_Port)
{
sockaddr_in server;
server.sin_family = AF_INET;
- server.sin_addr.s_addr = INTERNET_ADDRESS_LOCALHOST();
+ server.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
server.sin_port = htons(a_Port);
return (connect(m_Socket, (sockaddr *)&server, sizeof(server)) == 0);
}
diff --git a/source/OSSupport/Socket.h b/source/OSSupport/Socket.h
index ddaf7d8c0..34f09cc74 100644
--- a/source/OSSupport/Socket.h
+++ b/source/OSSupport/Socket.h
@@ -61,7 +61,6 @@ public:
static bool IsValidSocket(xSocket a_Socket);
- static unsigned long INTERNET_ADDRESS_LOCALHOST(void); // 127.0.0.1 represented in network byteorder; must be a function due to GCC :(
static const unsigned short ANY_PORT = 0; // When given to Bind() functions, they will find a free port
static const int DEFAULT_BACKLOG = 10;