diff options
| author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-03-29 19:00:25 +0200 | 
|---|---|---|
| committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-03-29 19:00:25 +0200 | 
| commit | 5269fec9106327db4ada313701ceae67d833e736 (patch) | |
| tree | 30698b7aa8227af14addcfe214a08a7b0983d05d /lib/Socket.cpp | |
| parent | 4fa485c237e48a2edb8c804b2abbdbb7e033dfc9 (diff) | |
| download | ODR-SourceCompanion-5269fec9106327db4ada313701ceae67d833e736.tar.gz ODR-SourceCompanion-5269fec9106327db4ada313701ceae67d833e736.tar.bz2 ODR-SourceCompanion-5269fec9106327db4ada313701ceae67d833e736.zip | |
Common: log timestamps and socket changes
Diffstat (limited to 'lib/Socket.cpp')
| -rw-r--r-- | lib/Socket.cpp | 9 | 
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; | 
