Pinging a machine from python

Zerge zerge69 at gmail.com
Sun May 25 20:21:14 EDT 2008


On May 25, 11:13 am, Prasanth <prasanth... at gmail.com> wrote:
> I tried pinging a machine from python using socket programming but
> could not do it. Is there any module which we can use to ping the
> machine < like net::ping in perl> or can you give me simple program.

Import OS
ip=192.168.1.1
pingtext="ping "+ip+" -n 1"
pingresult=os.popen(pingtext).readlines()

"OS" gives you access to the command line of the operating system.



More information about the Python-list mailing list