Go Down

Topic: ICMP ping library v2.0 (Read 3082 times) previous topic - next topic

Blake F

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

robtillaart


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?
Rob Tillaart

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

Blake F

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.

robtillaart

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.
Rob Tillaart

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

Federico0

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

Code: [Select]

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.

omkardokur

I am getting error message as this:

Code: [Select]
C:\Program Files\Arduino\libraries\icmp_ping\ICMPPing.cpp: In member function 'void ICMPPing::receiveEchoReply(const ICMPEcho&, const IPAddress&, ICMPEchoReply&)':
C:\Program Files\Arduino\libraries\icmp_ping\ICMPPing.cpp:177: error: invalid conversion from 'uint16_t' to 'volatile uint8_t*'
C:\Program Files\Arduino\libraries\icmp_ping\ICMPPing.cpp:177: error:   initializing argument 2 of 'void W5100Class::read_data(SOCKET, volatile uint8_t*, volatile uint8_t*, uint16_t)'
C:\Program Files\Arduino\libraries\icmp_ping\ICMPPing.cpp:185: error: invalid conversion from 'uint16_t' to 'volatile uint8_t*'
C:\Program Files\Arduino\libraries\icmp_ping\ICMPPing.cpp:185: error:   initializing argument 2 of 'void W5100Class::read_data(SOCKET, volatile uint8_t*, volatile uint8_t*, uint16_t)'

nazerisami

my error for this line


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

and i changed this line

byte pingAddr(74,125,26,147); // ip address to ping
i use arduino software 1.6.5

icmp ping  ver 2 fixed ?

Thanks for your answer
I need a program that will ping a device or tar mention being able to tell if something is not working and why Ardynv instance. Please note Hara.
Have you completed the program.
Can be used on the Snmp Ardynv
Should I use the ARm . Bnanpi
Do not respond to the ping Ardiono Where is my problem.


خیلی ممنونم اگر زودتر جواب بدین

Go Up