From: bert hubert Date: Tue, 18 Mar 2014 20:12:58 +0000 (+0100) Subject: add non-string version of Socket::sendTo() X-Git-Tag: rec-3.6.0-rc1~121 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4111e1aeffe4fd02610de7a2a16d79b3a339dea0;p=thirdparty%2Fpdns.git add non-string version of Socket::sendTo() --- 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) {