summaryrefslogtreecommitdiffstats
path: root/lib/Socket.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2022-03-29 16:43:19 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2022-03-29 16:43:19 +0200
commit6d1d9f47edef8352c6f25d7736171ec2bbe5471a (patch)
treeb9194956abb0f672c16b1136b90f59448cb86b75 /lib/Socket.cpp
parentcf58fa375c003173215baf81b4b64cf4e5c1873c (diff)
downloaddabmux-6d1d9f47edef8352c6f25d7736171ec2bbe5471a.tar.gz
dabmux-6d1d9f47edef8352c6f25d7736171ec2bbe5471a.tar.bz2
dabmux-6d1d9f47edef8352c6f25d7736171ec2bbe5471a.zip
Common: log timestamps, socket changes and frame_timestamp_t
Diffstat (limited to 'lib/Socket.cpp')
-rw-r--r--lib/Socket.cpp9
1 files changed, 9 insertions, 0 deletions
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<uint8_t>& 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;