diff --git a/src/SFML/Network/IpAddress.cpp b/src/SFML/Network/IpAddress.cpp index 73cf6a1e..ae3d90cb 100644 --- a/src/SFML/Network/IpAddress.cpp +++ b/src/SFML/Network/IpAddress.cpp @@ -139,13 +139,13 @@ IpAddress IpAddress::GetLocalAddress() return localAddress; // Connect the socket to localhost on any port - sockaddr_in address = priv::SocketImpl::CreateAddress(INADDR_LOOPBACK, 0); + sockaddr_in address = priv::SocketImpl::CreateAddress(ntohl(INADDR_LOOPBACK), 0); if (connect(sock, reinterpret_cast(&address), sizeof(address)) == -1) { priv::SocketImpl::Close(sock); return localAddress; } - + // Get the local address of the socket connection priv::SocketImpl::AddrLength size = sizeof(address); if (getsockname(sock, reinterpret_cast(&address), &size) == -1) diff --git a/src/SFML/Network/Unix/SocketImpl.cpp b/src/SFML/Network/Unix/SocketImpl.cpp index bf6c86a3..1cf50324 100644 --- a/src/SFML/Network/Unix/SocketImpl.cpp +++ b/src/SFML/Network/Unix/SocketImpl.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include namespace sf @@ -39,7 +39,7 @@ namespace priv sockaddr_in SocketImpl::CreateAddress(unsigned long address, unsigned short port) { sockaddr_in addr; - memset(addr.sin_zero, 0, sizeof(addr.sin_zero)); + std::memset(addr.sin_zero, 0, sizeof(addr.sin_zero)); addr.sin_addr.s_addr = htonl(address); addr.sin_family = AF_INET; addr.sin_port = htons(port);