diff --git a/lib/socket.cpp b/lib/socket.cpp index 420ae87b..3e8244da 100644 --- a/lib/socket.cpp +++ b/lib/socket.cpp @@ -1685,7 +1685,7 @@ void Socket::UDPConnection::SetDestination(std::string destIp, uint32_t port){ ss << port; memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; + hints.ai_family = family; hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = AI_ADDRCONFIG | AI_V4MAPPED; hints.ai_protocol = IPPROTO_UDP; diff --git a/lib/socket.h b/lib/socket.h index 108357c0..d5935f77 100644 --- a/lib/socket.h +++ b/lib/socket.h @@ -212,6 +212,8 @@ namespace Socket{ void setBlocking(bool blocking); void SetDestination(std::string hostname, uint32_t port); void GetDestination(std::string &hostname, uint32_t &port); + const void * getDestAddr(){return destAddr;} + size_t getDestAddrLen(){return destAddr_size;} std::string getBoundAddress(); uint32_t getDestPort() const; bool Receive();