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?
Mel

2004-10-22, 8:57 pm

This is what i do, if i know the server and the port:

########################################
############
####
########################################
############
proc ip {} {
#Trace

set me [socket -server garbage_word -myaddr [info hostname] 0]
set ip [lindex [fconfigure $me -sockname] 0]
close $me
return $ip
}

if it fails to return the ip, its DEAD !

"Tillmann Basien" <tab@basien n0spam.de> wrote in message
news:2tt01jF234vr1U1@uni-berlin.de...
> 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.
>
> regard
> tab
>
>



Tillmann Basien

2004-10-22, 8:57 pm

Possibly good to check, that my local host has an ip.
Whats about checking the avalibility of a destination ip.

ex:
socket destName 0
Is this a good way to try to open port 0 on destName

Posibily resulats are:
couldn't open socket: host is unreachable
couldn't open socket: connection refused
or a valid sock-Discriptor if there is a service 0

Other suggestions ?




"Mel" <mel.m.heravi@hp.com> schrieb im Newsbeitrag
news:4179533c$1@usenet01.boi.hp.com...
> This is what i do, if i know the server and the port:
>
> ########################################
############
> ####
> ########################################
############
> proc ip {} {
> #Trace
>
> set me [socket -server garbage_word -myaddr [info hostname] 0]
> set ip [lindex [fconfigure $me -sockname] 0]
> close $me
> return $ip
> }
>
> if it fails to return the ip, its DEAD !
>
> "Tillmann Basien" <tab@basien n0spam.de> wrote in message
> news:2tt01jF234vr1U1@uni-berlin.de...
> 0 }
>
>



Sponsored Links







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

Copyright 2008 codecomments.com