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

A few years ago I posted my ICMP ping library here. Motivated by a bunch of recent inquiries about it, I've released version 2.0 of the library. It now lives in Github:

https://github.com/BlakeFoster/Arduino-Ping

The big improvement over version 1.0 (which was geared more toward a specific use) is that it returns the response as an object instead of a string, and lets the caller decide what to do with it. I also fixed a few minor bugs.

I hope that someone finds it useful, or even better, improves it and pushes the changes back upstream.

Cheers,
Blake
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13478
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Thanks for sharing, looks really good!

A quick look at the code shows little opportunity to make serious improvements.
The only point I found is that sending the ping has a while loop that can timeout. That always makes me wandering if it can be done async ?

You might check - http://tools.ietf.org/html/rfc792 - to map the error codes to the RFC spec (minor point),
(maybe add the RFC or link to, as documentation?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Newbie
*
Karma: 2
Posts: 10
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the comments.  You actually hit on my next TODO--I've been tinkering with making the error codes match the RFC.

I could see how having an asynchronous version of the API might be useful as well. Probably three functions, one to send a request, one to check if a response is available, and one to receive a response.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13478
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Probably three functions, one to send a request, one to check if a response is available, and one to receive a response.
That would be a good implementation

The other one could involve register a callback function (event driven), but for an Arduino I think that is overkill.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

provincia di Forlì
Offline Offline
Full Member
***
Karma: 0
Posts: 119
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Blake, i really enjoyed your first version of ICMP Ping library (as a bcontent i am smiley, now i try to use your new version but there is a line that i don't understand..

Code:
ICMPPing ping(pingSocket, (uint16_t)random(0, 255));

I remember in your previously version it was ICMPPing ping(ping Socket), what means the "new" part ? i tried to delete but it doesn't work.
Logged

Pages: [1]   Go Up
Jump to: