fix for UDP connection introduced 20200411 with fix for #336 (fixes #383

This commit is contained in:
john30
2021-01-10 21:25:37 +01:00
parent cff4e4a8cb
commit 2f3f04222e
+3 -2
View File
@@ -683,8 +683,9 @@ result_t NetworkDevice::open() {
}
int ret;
if (m_udp) {
address.sin_addr.s_addr = INADDR_ANY;
ret = bind(m_fd, (struct sockaddr*)&address, sizeof(address));
struct sockaddr_in bindAddress = address;
bindAddress.sin_addr.s_addr = INADDR_ANY;
ret = bind(m_fd, (struct sockaddr*)&bindAddress, sizeof(address));
} else {
int value = 1;
ret = setsockopt(m_fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<void*>(&value), sizeof(value));