From 4111e1aeffe4fd02610de7a2a16d79b3a339dea0 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Tue, 18 Mar 2014 21:12:58 +0100 Subject: [PATCH] add non-string version of Socket::sendTo() --- pdns/sstuff.hh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pdns/sstuff.hh b/pdns/sstuff.hh index 1106073fb5..e674548eee 100644 --- a/pdns/sstuff.hh +++ b/pdns/sstuff.hh @@ -152,15 +152,21 @@ public: //! For datagram sockets, send a datagram to a destination + void sendTo(const char* msg, unsigned int len, const ComboAddress &ep) + { + if(sendto(d_socket, msg, len, 0, (sockaddr *)&ep, ep.getSocklen())<0) + throw NetworkError(strerror(errno)); + } + /** For datagram sockets, send a datagram to a destination \param dgram The datagram \param ep The intended destination of the datagram */ void sendTo(const string &dgram, const ComboAddress &ep) { - if(sendto(d_socket, dgram.c_str(), (int)dgram.size(), 0, (sockaddr *)&ep, ep.getSocklen())<0) - throw NetworkError(strerror(errno)); + sendTo(dgram.c_str(), dgram.length(), ep); } + //! Write this data to the socket, taking care that all bytes are written out void writen(const string &data) { -- 2.47.3