diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2016-10-26 18:27:01 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2016-10-26 18:27:01 +0200 |
commit | 25e29972a9df712cb51fc66e553b34f3dc441e51 (patch) | |
tree | 7aa80166a70091c44c44d5935529dac43eb2bae1 /platform | |
parent | c67e3a485dedae96b82c3356d5f45ab0509d7759 (diff) |
Fix PacketPeerUDP get_packet_port()
Properly convert port field from network to system ordering on incoming packets.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/windows/packet_peer_udp_winsock.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/platform/windows/packet_peer_udp_winsock.cpp b/platform/windows/packet_peer_udp_winsock.cpp index 0408a303f5..b4cd60979c 100644 --- a/platform/windows/packet_peer_udp_winsock.cpp +++ b/platform/windows/packet_peer_udp_winsock.cpp @@ -166,7 +166,7 @@ Error PacketPeerUDPWinsock::_poll(bool p_wait) { rb.write(&type, 1); struct sockaddr_in* sin_from = (struct sockaddr_in*)&from; rb.write((uint8_t*)&sin_from->sin_addr, 4); - port = sin_from->sin_port; + port = ntohs(sin_from->sin_port); } else if (from.ss_family == AF_INET6) { @@ -176,7 +176,7 @@ Error PacketPeerUDPWinsock::_poll(bool p_wait) { struct sockaddr_in6* s6_from = (struct sockaddr_in6*)&from; rb.write((uint8_t*)&s6_from->sin6_addr, 16); - port = s6_from->sin6_port; + port = ntohs(s6_from->sin6_port); } else { // WARN_PRINT("Ignoring packet with unknown address family"); |