aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/examples/net_resolve.v
blob: ddc058d04f775670a1cf22cf8f6bedce3b9010d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import net

for addr in [
	'vlang.io:80',
	'google.com:80',
	'steampowered.com:80',
	'api.steampowered.com:80',
] {
	println('$addr')

	for @type in [net.SocketType.tcp, .udp] {
		family := net.AddrFamily.unspec

		addrs := net.resolve_addrs(addr, family, @type) or {
			println('> None')
			continue
		}

		for a in addrs {
			f := a.family()
			println('> $a $f ${@type}')
		}
	}
}