Pages: [1]   Go Down
Author Topic: ICMP Ping Library  (Read 7165 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 1
Posts: 10
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As part of a project I'm working on, I need to ping computers on my network with the Arduino Ethernet shield.  I saw several old posts on the forum asking how to send out pings from the ethernet shield, so I've made my ping code into a library, available here:

http://www.blake-foster.com/projects/ICMPPing.zip

I hope someone finds this useful!
« Last Edit: September 30, 2010, 11:51:17 am by blfoster » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 37
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ooooh, nice. Many thanks! Even if I don't use it I'm sure I will be able to learn a lot from it.

Many thanks for your efforts.

Glyn
Logged

Bangkok
Offline Offline
Full Member
***
Karma: 0
Posts: 173
freeduino.de Admin
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it possible to get the packet loss value with your library?
Logged

0
Offline Offline
Sr. Member
****
Karma: 11
Posts: 292
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank for the code, I will have a look at it

Oh... by the way, nice web site  smiley-wink
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried to use this tiny little library in my arduino project because i lost connection between the ethernet shield and my router. After reconnection i always had to reset the arduino to make ethernet working again.
So my idea was to use the ICMPPing every hour to find out if my connection still exists. If not i do a "ethernet.begin(..)" again and with this the w5100 is not resetted but restarted and in most cases the net is working again.

But i have the weird behavior that every second hour the ping gets a timeout even when the net is ok.

Here is a small part of my logfile (because i couldn't believe it i extended the text which is given back so that i can see how many loops have been passed in every case):

Code:
Dienstag 2010-11-30 19:05:04
Request Timed Out. Reply[4]
Dienstag 2010-11-30 20:05:06
Reply[1] from: 192.168.1.1: bytes=32 time=2ms TTL=128
Dienstag 2010-11-30 21:05:07
Request Timed Out. Reply[4]
Dienstag 2010-11-30 22:05:05
Reply[1] from: 192.168.1.1: bytes=32 time=2ms TTL=128
I changed the used socket number from 0 to 1 with no effect.

Concerning the net my application is reacting passive. That means that in the BIG loop nothing happens if there is no request from another computer. If there is a request it is executed and then the loop starts again. So when i am calling the ping there is no other net activity pending on the arduino.

Anybody who has an idea?

Thanks a lot.
Klaus
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It seems that i found a solution for my problem:

Using socket number 3 all pings are successful.
I expanded the ping-example with the WebServer example (from the Ethernet library) and with socket #0 and 1 i had no success.
Then i tried socket number 3 in my own application and since then everything is fine.

Thanks to Blake for this routine. I tried to examine the source but it is really tricky and goes very deep so i didn't try to make any changes.

Klaus
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
Internet of Things!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, this is very useful. Found this by accident looking for the Parallax PING...
Logged

Pages: [1]   Go Up
Jump to: