Network statistics program

Greg Fortune gfor_ewu at ispchannel.com
Wed May 17 14:58:32 EDT 2000


Right now, I'm just sending the output of the ping to a text file and then
reading it from there.

os.system('ping -t 1 208.152.8.1 > convertor_temp.txt')
#Read input file and extract result
#Store result

  That circumvents the need for the select.  The only reason I've done this
is because the os.system call will not return the output from the call (and
I'm very new to this language as well as "real-world" programming <g>).  Is
there another way (possibly the select you mentioned) to get the output from
a call back to the program?  I need to use this on both Linux and Windows so
I can't use the UNIX specific commands module.

Greg

Cedric Adjih <adjih at crepuscule.com> wrote in message
news:8ftqtk$25a$1 at ites.inria.fr...
>
> You can use module time, function sleep:
>   time.sleep(1.1) # sleep 1.1 seconds
> Or if you are waiting for events or for a timeout, select
> will be helpful:
>   select.select([file desc list]..., timeOutInSeconds)
> For instance if you are waiting for a ping reply.
>
> -- Cedric
>





More information about the Python-list mailing list