You are looking at historical revision 29201 of this page. It may differ significantly from its current revision.

eping

eping is a Scheme implementation of the ICMP ping utility. Although it can be used like an average OS ping utility, eping is intended to be used programmatically (e.g. for gathering statistics, monitoring). It uses raw sockets thus a privileged account must be used.

[procedure] (eping HOST #!key (mode 'probe)
                             (count #f)
                             (timeout 1000)
                             (interval 1000)
                             (ttl 64)
                             (tos 0)
                             (dont-fragment #f)
                             (src-addr #f)
                             (id #f)
                             (seq-start 0)
                             (size 56)
                             (pattern "")
                             (recv-min #f)
                             (lost-max #f)
                             (cons-recv-min #f)
                             (cons-lost-max #f)
                             (msg1 "%i is alive%n")
                             (msg2 "")
                             (dotcols 0)
                             (quiet #t))

HOST can be either an IPv4 address or an hostname: '192.168.1.1 , "192.168.1.1" , 'example.com, "example.com" are all valid hosts.

eping supports four modes of operation: probe (default), stats, dot and mtu.

Probe mode

In this mode eping returns true or false if it considers an host alive or unreachable respectively. The default behavior is to consider an host alive as soon as an echo reply is received. If no reply is received in count attempts, the host is considered unreachable. If not specified, count is 5 by default. Probe mode is the default one so it can be omitted as parameter.

(eping "call-cc.org")

===> #t

The aliveness criteria can be changed through the four parameters recv-min, lost-max, cons-recv-min, cons-lost-max (see "Parameters" section). As soon as one of this conditions is met eping returns the associated boolean value. If no condition is met in count attempts #f is returned.

In non-quiet 'submode' a message is displayed as well.

(eping "call-cc.org" quiet: #f)
209.172.49.65 is alive

The output message can be customized through the msg1 and msg2 parameters.

Stats mode

Dot mode

Mtu mode

Parameters

Usage

(use eping)

About this egg

Version History

1.0
Initial release

Author

Michele La Monaca

License

Copyright (c) 2013
Michele La Monaca (mikele~lamonaca.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1) Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2) Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3) Neither the name of the author nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.