Merge pull request #219 from miguelestrada/miguelestrada-correct-ip-address

display correct IP address
This commit is contained in:
Jonathan Naylor 2021-08-24 18:40:18 +01:00 committed by GitHub
commit 6b46309ba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -169,14 +169,14 @@ char* CUDPSocket::display(const sockaddr_storage& addr, char* buffer, unsigned i
switch (addr.ss_family) {
case AF_INET: {
struct sockaddr_in* in4 = (struct sockaddr_in*)&addr;
::inet_ntop(AF_INET, &in4, buffer, length);
::inet_ntop(AF_INET, &in4->sin_addr, buffer, length);
::sprintf(buffer + ::strlen(buffer), ":%u", in4->sin_port);
}
break;
case AF_INET6: {
struct sockaddr_in6* in6 = (struct sockaddr_in6*)&addr;
::inet_ntop(AF_INET6, &in6, buffer, length);
::inet_ntop(AF_INET6, &in6->sin6_addr, buffer, length);
::sprintf(buffer + ::strlen(buffer), ":%u", in6->sin6_port);
}
break;