 : alive? ( host -- ? )
     [ ping drop t ] [ 2drop f ] recover ;
 
-

USING: accessors byte-arrays calendar checksums
checksums.internet combinators combinators.smart continuations
destructors io.sockets io.sockets.icmp io.timeouts kernel pack
random sequences ;

IN: ping


    <icmp> resolve-host [ icmp4? ] filter random
    f <icmp4> <datagram>
        1 seconds over set-timeout
    [ [ send-ping ] [ recv-ping ] 2bi ] with-disposal ;

: local-ping ( -- reply )
    "127.0.0.1" ping ;
