[ [ [ ipv4? ] [ ipv6? ] bi or ] all? ] bi
] unit-test
+[ t t ] [
+ f resolve-host
+ [ length 1 >= ]
+ [ [ [ ipv4? ] [ ipv6? ] bi or ] all? ] bi
+] unit-test
+
+[ t t ] [
+ f 0 <inet> resolve-host
+ [ length 1 >= ]
+ [ [ [ ipv4? ] [ ipv6? ] bi or ] all? ] bi
+] unit-test
+
! Smoke-test UDP
[ ] [ "127.0.0.1" 0 <inet4> <datagram> "datagram1" set ] unit-test
[ ] [ "datagram1" get addr>> "addr1" set ] unit-test
"hi\n" write flush readln readln
] with-client
] unit-test
+
+! Binding to all interfaces should work
+[ ] [ f 0 <inet4> <datagram> dispose ] unit-test
! Addressing
<PRIVATE
+UNION: ?string string POSTPONE: f ;
+
GENERIC: protocol-family ( addrspec -- af )
GENERIC: sockaddr-size ( addrspec -- n )
SLOT: port
-TUPLE: ipv4 { host string read-only } ;
+TUPLE: ipv4 { host ?string read-only } ;
C: <ipv4> ipv4
M: inet4 present
[ host>> ] [ port>> number>string ] bi ":" glue ;
-TUPLE: ipv6 { host string read-only } ;
+TUPLE: ipv6 { host ?string read-only } ;
C: <ipv6> ipv6
GENERIC: resolve-host ( addrspec -- seq )
-TUPLE: hostname host ;
+TUPLE: hostname { host ?string read-only } ;
TUPLE: inet < hostname port ;