diff --git a/CHANGES b/CHANGES index b593254f4..e51932636 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,7 @@ Bugfixes: - All: Fix several file handle leaks - Util: Use closesocket on Windows - GBA Memory: Fix executing code from OBJ region of VRAM + - Util: Fix socket bind addresses Misc: - GBA: Slightly optimize GBAProcessEvents - Qt: Add preset for DualShock 4 diff --git a/src/util/socket.h b/src/util/socket.h index af9461745..ad5499ac5 100644 --- a/src/util/socket.h +++ b/src/util/socket.h @@ -109,7 +109,7 @@ static inline Socket SocketOpenTCP(int port, const struct Address* bindAddress) memset(&bindInfo, 0, sizeof(bindInfo)); bindInfo.sin_family = AF_INET; bindInfo.sin_port = htons(port); - bindInfo.sin_addr.s_addr = bindAddress->ipv4; + bindInfo.sin_addr.s_addr = htonl(bindAddress->ipv4); err = bind(sock, (const struct sockaddr*) &bindInfo, sizeof(bindInfo)); } else { struct sockaddr_in6 bindInfo; @@ -144,7 +144,7 @@ static inline Socket SocketConnectTCP(int port, const struct Address* destinatio memset(&bindInfo, 0, sizeof(bindInfo)); bindInfo.sin_family = AF_INET; bindInfo.sin_port = htons(port); - bindInfo.sin_addr.s_addr = destinationAddress->ipv4; + bindInfo.sin_addr.s_addr = htonl(destinationAddress->ipv4); err = connect(sock, (const struct sockaddr*) &bindInfo, sizeof(bindInfo)); } else { struct sockaddr_in6 bindInfo;