For Programmers: Free Programming Magazines  


Home > Archive > Tcl > October 2004 > Re: tclProcedure: Is Server Alive?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: tclProcedure: Is Server Alive?
Pat Thoyts

2004-10-22, 8:57 pm

"Tillmann Basien" <tab@basien n0spam.de> writes:

>Hy,
>does anybody has a good and simple method to check a server?
>Here is what I do, but what`s not good.
>
>set alive 1; if [catch {exec ping -c 2 $name >& /dev/null}] { set alive 0 }
>
>I want to use this on linux and solaris.


If you know the host should respond on some port (like port 80 for
example) then this wiki page
http://mini.net/tcl/9829
shows how to scan for hosts rapidly.

Briefly you can use socket -async and fileevent writable.

Alternatively there are extensions that can provide ICMP for Tcl
(hping?)
--
Pat Thoyts http://www.zsplat.freeserve.co.uk/resume.html
To reply, rot13 the return address or read the X-Address header.
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com