need something like threads, or just multiple simulateous exec's

Serge A. Ribalchenko fisher at energy.uch.net
Mon Jan 26 05:36:48 EST 2004


Hi all,

I'm new in python coding...
Can someone point me how can I do such a usual thing? I need to ping
some hosts, and harvest results in one list. Just cause there is about 
120 hosts in the LAN, and approx. 10% is down at working hours, pinging
each host at a time from cycle is VERY slow solution.
I did:
retv = os.popen('ping -c 1 ' + ip + ' |grep \"1 packet\" |awk  \'{print 
$4}\'')
res = retv.read() 

In cycle. BUT. I need something FASTER. And I feel fear to scary word 
'thread'. May someone give me some examle using threads for this 
purpose? Thanks.


Best wishes,
~       Serge.




More information about the Python-list mailing list