mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Broadcast to the given address.
This commit is contained in:
parent
fd6d510051
commit
6f83044cf6
@ -603,6 +603,7 @@ bool UdpBroadcast::Open( const char* addr, uint16_t port )
|
|||||||
if( !ptr ) return false;
|
if( !ptr ) return false;
|
||||||
|
|
||||||
m_sock = sock;
|
m_sock = sock;
|
||||||
|
m_addr = inet_addr( addr );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +624,7 @@ int UdpBroadcast::Send( uint16_t port, const void* data, int len )
|
|||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
addr.sin_port = htons( port );
|
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 ) );
|
return sendto( m_sock, (const char*)data, len, MSG_NOSIGNAL, (sockaddr*)&addr, sizeof( addr ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +107,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int m_sock;
|
int m_sock;
|
||||||
|
uint32_t m_addr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IpAddress
|
class IpAddress
|
||||||
|
Loading…
Reference in New Issue
Block a user