[Tutor] Pinging a service

Alan Gauld alan.gauld at btinternet.com
Fri Jun 13 02:16:40 CEST 2008


"Greg Lindstrom" <gslindstrom at gmail.com> wrote

> A) Is this a sound strategy?
Yes provided you keep the poll period sensible - say
once per minute at the most Otherwise your pings become
a significant overhead in themselves!

> B) Are there libraries for the "ping"ing aspect?  If not, I can
> execute the ping using "command"...how can I capture the screen 
> output
> to get the times?

You can use sockets to send raw ICMP messages but
using standard ping via the os is ok for this. Use the subprocess 
module
and Popen object to get the outpurt from the command.


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list