Handle IPv6 in bindAddr #7633

Add test
This commit is contained in:
Federico Ceratto 2019-02-19 22:55:35 +00:00 • committed by Dominik Picheta
commit 28a83a8388
2 changed files with 26 additions and 13 deletions

14
tests/stdlib/tnetbind.nim Normal file
View file

@ -0,0 +1,14 @@
import net
## Test for net.bindAddr
proc test() =
# IPv4 TCP
newSocket(AF_INET, SOCK_STREAM, IPPROTO_TCP).bindAddr(Port(1900), "0.0.0.0")
newSocket(AF_INET, SOCK_STREAM, IPPROTO_TCP).bindAddr(Port(1901))
# IPv6 TCP
newSocket(AF_INET6, SOCK_STREAM, IPPROTO_TCP).bindAddr(Port(1902), "::")
newSocket(AF_INET6, SOCK_STREAM, IPPROTO_TCP).bindAddr(Port(1903))
test()