add: binn for communication
This commit is contained in:
parent
6e6d29f410
commit
b4eec336a2
6 changed files with 4331 additions and 30 deletions
helpers
|
@ -5,7 +5,7 @@
|
|||
#include <helpers.h>
|
||||
|
||||
int
|
||||
helpers::send_udp_broadcast(const char *addr, uint16_t port, const char* message)
|
||||
helpers::send_udp_broadcast(const char *addr, uint16_t port, void *message, size_t length)
|
||||
{
|
||||
struct sockaddr_in their_addr{};
|
||||
int fd;
|
||||
|
@ -28,7 +28,7 @@ helpers::send_udp_broadcast(const char *addr, uint16_t port, const char* message
|
|||
their_addr.sin_port = htons(port);
|
||||
their_addr.sin_addr.s_addr = inet_addr(addr);
|
||||
|
||||
if(sendto(fd, message, strlen(message), 0, (struct sockaddr *)&their_addr, sizeof(their_addr)) < 0)
|
||||
if(sendto(fd, message, length, 0, (struct sockaddr *)&their_addr, sizeof(their_addr)) < 0)
|
||||
{
|
||||
LOG_ERROR << "Error sending broadcast " << errno << " " << strerror(errno);
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue