From 6f83044cf6d61c9d4759fbdd26ace419af2370a9 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 16 Dec 2020 15:24:20 +0100 Subject: [PATCH] Broadcast to the given address. --- common/TracySocket.cpp | 3 ++- common/TracySocket.hpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/TracySocket.cpp b/common/TracySocket.cpp index c9196163..5257f679 100644 --- a/common/TracySocket.cpp +++ b/common/TracySocket.cpp @@ -603,6 +603,7 @@ bool UdpBroadcast::Open( const char* addr, uint16_t port ) if( !ptr ) return false; m_sock = sock; + m_addr = inet_addr( addr ); return true; } @@ -623,7 +624,7 @@ int UdpBroadcast::Send( uint16_t port, const void* data, int len ) struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons( port ); - addr.sin_addr.s_addr = INADDR_BROADCAST; + addr.sin_addr.s_addr = m_addr; return sendto( m_sock, (const char*)data, len, MSG_NOSIGNAL, (sockaddr*)&addr, sizeof( addr ) ); } diff --git a/common/TracySocket.hpp b/common/TracySocket.hpp index e91f8ead..4de4cca1 100644 --- a/common/TracySocket.hpp +++ b/common/TracySocket.hpp @@ -107,6 +107,7 @@ public: private: int m_sock; + uint32_t m_addr; }; class IpAddress