]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
add non-string version of Socket::sendTo()
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 18 Mar 2014 20:12:58 +0000 (21:12 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Tue, 18 Mar 2014 20:12:58 +0000 (21:12 +0100)
pdns/sstuff.hh

index 1106073fb50c5914aaab49a6d51cbd43b7347b5b..e674548eee104279a5fa174c37b3d1eb093cfcdb 100644 (file)
@@ -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)
   {