summary refs log tree commit diff stats
path: root/tests/stdlib/tnetbind.nim
blob: 84f9ac464270cd5d6fbdba3ee53446489f38a3c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
discard """
matrix: "--mm:refc; --mm:orc"
joinable: false
"""

#[
joinable: false
otherwise:
Error: unhandled exception: Address already in use [OSError]
]#

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()