Broadcast to the given address.

This commit is contained in:
Bartosz Taudul 2020-12-16 15:24:20 +01:00
parent fd6d510051
commit 6f83044cf6
2 changed files with 3 additions and 1 deletions

View File

@ -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 ) );
}

View File

@ -107,6 +107,7 @@ public:
private:
int m_sock;
uint32_t m_addr;
};
class IpAddress