 
 : <inet4> ( host port -- inet4 )
     over check-ipv4 inet4 boa ;
-
-: <random-local-inet4> ( -- inet4 ) f 0 <inet4> ;
 
 M: ipv4 with-port [ host>> ] dip <inet4> ;
 

: protocol-port ( protocol -- port )
    [ f getservbyname [ port>> htons ] [ f ] if* ] [ f ] if* ;

{
    { [ os unix? ] [ "io.sockets.unix" require ] }
    { [ os windows? ] [ "io.sockets.windows" require ] }

: send ( bytes addrspec datagram -- )
    check-send (send) ; inline

MEMO: ipv6-supported? ( -- ? )
    [ "::1" 0 <inet6> binary <server> dispose t ] [ drop f ] recover ;

