Don't forget that there are working scripts available here that are valuable in learning something new with working code as the example. Checking out the Networking Code from the Code section shows a few scripts on pinging such as this one that should get you started on what you are trying to do.
in reply to Re^2: Need a couple of scripts - help?
in thread Need a couple of scripts - help?
"The trouble with having an open mind, of course,
is that people will insist on coming along
and trying to put things in it." - Terry Pratchett