python - Is there a way to ping multiple devices quickly -
hi writing script check network see if certen people connected getting devices mac addresses arp, 0.5% through , have problem. have ping ip addresses 192.168.1.2-254. incredibly slow there quicker way:
code:
inport os ipcount=2 ipup=[] while ipcount<254: response=os.system("ping -c 1 192.168.1." + str(ipcount)) if response == 0: ipup.append("192.168.1."+str(ipcount)) ipcount=ipcount+1
ping in parallel in many threads. time spent waiting response, multiple threads can speed process. you'd create threads in advance , maybe reuse them because thread creation pretty slow.
edit:
another way implement ping using async network io.
Comments
Post a Comment