Skip to content

Commit

Permalink
swap port to correct port order
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaremy Creechley committed Nov 23, 2021
1 parent 1b143f5 commit 33a66a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pure/net.nim
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,14 @@ proc toSockAddr*(address: IpAddress, port: Port, sa: var Sockaddr_storage,
sl = sizeof(Sockaddr_in).SockLen
let s = cast[ptr Sockaddr_in](addr sa)
s.sin_family = typeof(s.sin_family)(toInt(AF_INET))
s.sin_port = port
s.sin_port = htons(port)
copyMem(addr s.sin_addr, unsafeAddr address.address_v4[0],
sizeof(s.sin_addr))
of IpAddressFamily.IPv6:
sl = sizeof(Sockaddr_in6).SockLen
let s = cast[ptr Sockaddr_in6](addr sa)
s.sin6_family = typeof(s.sin6_family)(toInt(AF_INET6))
s.sin6_port = port
s.sin6_port = htons(port)
copyMem(addr s.sin6_addr, unsafeAddr address.address_v6[0],
sizeof(s.sin6_addr))

Expand Down

0 comments on commit 33a66a9

Please sign in to comment.