Show correct address for ipv6 sockets, fixes #7634 (#10505)

This commit is contained in:
LemonBoy
2019-01-31 07:34:26 +01:00
committed by Miran
parent abcd9fd2e8
commit 81e5a35d56
2 changed files with 2 additions and 2 deletions

View File

@@ -1295,7 +1295,7 @@ proc recvFrom*(socket: Socket, data: var string, length: int,
if result != -1:
data.setLen(result)
address = $inet_ntoa(sockAddress.sin_addr)
address = getAddrString(cast[ptr SockAddr](addr(sockAddress)))
port = ntohs(sockAddress.sin_port).Port
else:
raiseOSError(osLastError())

View File

@@ -896,7 +896,7 @@ proc getProcessTimes*(hProcess: Handle; lpCreationTime, lpExitTime,
dynlib: "kernel32", importc: "GetProcessTimes".}
type inet_ntop_proc = proc(family: cint, paddr: pointer, pStringBuffer: cstring,
stringBufSize: int32): cstring {.gcsafe, stdcall.}
stringBufSize: int32): cstring {.gcsafe, stdcall, tags: [].}
var inet_ntop_real: inet_ntop_proc = nil