From 6d1d9f47edef8352c6f25d7736171ec2bbe5471a Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 29 Mar 2022 16:43:19 +0200 Subject: Common: log timestamps, socket changes and frame_timestamp_t --- lib/Socket.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/Socket.cpp') diff --git a/lib/Socket.cpp b/lib/Socket.cpp index d12c970..1ff6418 100644 --- a/lib/Socket.cpp +++ b/lib/Socket.cpp @@ -259,6 +259,15 @@ void UDPSocket::send(const std::vector& data, InetAddress destination) } } +void UDPSocket::send(const std::string& data, InetAddress destination) +{ + const int ret = sendto(m_sock, data.data(), data.size(), 0, + destination.as_sockaddr(), sizeof(*destination.as_sockaddr())); + if (ret == SOCKET_ERROR && errno != ECONNREFUSED) { + throw runtime_error(string("Can't send UDP packet: ") + strerror(errno)); + } +} + void UDPSocket::joinGroup(const char* groupname, const char* if_addr) { ip_mreqn group; -- cgit v1.2.3