summaryrefslogtreecommitdiffstats
path: root/contrib/Socket.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2022-03-29 17:17:58 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2022-03-29 17:17:58 +0200
commit3873a40d9aa8e51560ac18bfbf0c18c1ff7a30dc (patch)
tree20903c97199079ad7ecd7df1d6cc919b19bbd267 /contrib/Socket.cpp
parent3c6e2aa8afd108ab9f2d517ef2e2aab96f68c7ef (diff)
downloadODR-AudioEnc-3873a40d9aa8e51560ac18bfbf0c18c1ff7a30dc.tar.gz
ODR-AudioEnc-3873a40d9aa8e51560ac18bfbf0c18c1ff7a30dc.tar.bz2
ODR-AudioEnc-3873a40d9aa8e51560ac18bfbf0c18c1ff7a30dc.zip
Common: log timestamps and socket changes
Diffstat (limited to 'contrib/Socket.cpp')
-rw-r--r--contrib/Socket.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/Socket.cpp b/contrib/Socket.cpp
index d12c970..1ff6418 100644
--- a/contrib/Socket.cpp
+++ b/contrib/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;