Netstat Speed

DarkBlue nomail at nixmail.com
Sat Sep 2 12:25:46 CEST 2006


Following code works . 
My question is can I make it faster ?


def activeip(checkip):
     # if there is any line returned we set activeb to 1 indicating that
     # this ip is active during a netstat run   
     activeb=0          
     for line in os.popen("netstat -a -n | grep '%s'" % checkip) :
     s=line
     if s <>'' :
        activeb=1
     return activeb 


Thanks



More information about the Python-list mailing list