Socket::UDPConnection now uses its currently bound socket type for destinations

This commit is contained in:
Thulinma 2020-05-25 23:28:47 +02:00
parent b9c03ccb18
commit 540694df1f
2 changed files with 3 additions and 1 deletions

View file

@ -1685,7 +1685,7 @@ void Socket::UDPConnection::SetDestination(std::string destIp, uint32_t port){
ss << port; ss << port;
memset(&hints, 0, sizeof(struct addrinfo)); memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; hints.ai_family = family;
hints.ai_socktype = SOCK_DGRAM; hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_ADDRCONFIG | AI_V4MAPPED; hints.ai_flags = AI_ADDRCONFIG | AI_V4MAPPED;
hints.ai_protocol = IPPROTO_UDP; hints.ai_protocol = IPPROTO_UDP;

View file

@ -212,6 +212,8 @@ namespace Socket{
void setBlocking(bool blocking); void setBlocking(bool blocking);
void SetDestination(std::string hostname, uint32_t port); void SetDestination(std::string hostname, uint32_t port);
void GetDestination(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(); std::string getBoundAddress();
uint32_t getDestPort() const; uint32_t getDestPort() const;
bool Receive(); bool Receive();