Commit b4d617ee authored by jan.koester's avatar jan.koester
Browse files

fixed addr

parent dde982e6
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -261,9 +261,6 @@ void netplus::tcp::connect(socket *ssock){


void netplus::tcp::getAddress(std::string &addr){
    if(!_SocketInfo)
        return;

    char buf[512];

    addr = inet_ntop(((struct addrinfo*)_SocketInfo)->ai_family,
+6 −5
Original line number Diff line number Diff line
@@ -262,9 +262,10 @@ void netplus::udp::connect(socket *ssock){


void netplus::udp::getAddress(std::string &addr){
    if(!_SocketInfo)
        return;
    char ipaddr[INET6_ADDRSTRLEN];
    inet_ntop(((struct addrinfo*)_SocketInfo)->ai_family,((struct addrinfo*)_SocketInfo)->ai_addr, ipaddr, ((struct addrinfo*)_SocketInfo)->ai_addrlen);
    addr=ipaddr;
    char buf[512];

    addr = inet_ntop(((struct addrinfo*)_SocketInfo)->ai_family,
        &((struct addrinfo*)_SocketInfo)->ai_addr->sa_data + sizeof(struct sockaddr_storage), buf,
        ((struct addrinfo*)_SocketInfo)->ai_addrlen
    );
}
+6 −3
Original line number Diff line number Diff line
@@ -239,7 +239,10 @@ void netplus::tcp::connect(socket *ssock){


void netplus::tcp::getAddress(std::string &addr){
    char ipaddr[INET6_ADDRSTRLEN];
    inet_ntop(AF_INET6, ((struct addrinfo*)_SocketInfo)->ai_addr, ipaddr, ((struct addrinfo*)_SocketInfo)->ai_addrlen);
    addr=ipaddr;
    char buf[512];

    addr = inet_ntop(((struct addrinfo*)_SocketInfo)->ai_family,
        &((struct addrinfo*)_SocketInfo)->ai_addr->sa_data + sizeof(struct sockaddr_storage), buf,
        ((struct addrinfo*)_SocketInfo)->ai_addrlen
    );
}
+6 −3
Original line number Diff line number Diff line
@@ -234,7 +234,10 @@ void netplus::udp::connect(socket* ssock) {


void netplus::udp::getAddress(std::string& addr) {
    char ipaddr[INET6_ADDRSTRLEN];
    inet_ntop(AF_INET6, ((struct addrinfo*)_SocketInfo)->ai_addr, ipaddr, ((struct addrinfo*)_SocketInfo)->ai_addrlen);
    addr = ipaddr;
    char buf[512];

    addr = inet_ntop(((struct addrinfo*)_SocketInfo)->ai_family,
        &((struct addrinfo*)_SocketInfo)->ai_addr->sa_data + sizeof(struct sockaddr_storage), buf,
        ((struct addrinfo*)_SocketInfo)->ai_addrlen
    );
}