#include <functional>
#include "ahuexception.hh"
#include "misc.hh"
+#include <sys/socket.h>
+#include <netdb.h>
+
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <boost/lexical_cast.hpp>
string toString() const
{
- char tmp[128];
- if(sin4.sin_family==AF_INET && !Utility::inet_ntop(AF_INET, ( const char * ) &sin4.sin_addr, tmp, sizeof(tmp)))
- return tmp;
-
- if(sin4.sin_family==AF_INET6 && !Utility::inet_ntop(AF_INET6, ( const char * ) &sin6.sin6_addr, tmp, sizeof(tmp)))
- return tmp;
+ char host[1024];
+ getnameinfo((struct sockaddr*) this, getSocklen(), host, sizeof(host),0, 0, NI_NUMERICHOST);
- return tmp;
+ return host;
}
string toStringWithPort() const
}
d_highfd=max(s,d_highfd);
d_sockets.push_back(s);
- L<<Logger::Error<<"UDPv6 server bound to ["<<localname<<"]:"<<::arg().asNum("local-port")<<endl;
+ L<<Logger::Error<<"UDPv6 server bound to "<<locala.toStringWithPort()<<endl;
FD_SET(s, &d_rfds);
}
#endif // WIN32