Arduino Forum

Development => Other Software Development => Topic started by: blfoster on Apr 18, 2013, 03:37 am

Title: ICMP ping library v2.0
Post by: blfoster on Apr 18, 2013, 03:37 am
A few years ago I posted my ICMP ping library (http://arduino.cc/forum/index.php/topic,8701.0.html) 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
Title: Re: ICMP ping library v2.0
Post by: robtillaart on Apr 18, 2013, 07:50 pm

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?
Title: Re: ICMP ping library v2.0
Post by: blfoster on Apr 19, 2013, 02:12 am
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.
Title: Re: ICMP ping library v2.0
Post by: robtillaart on Apr 20, 2013, 09:28 am
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.
Title: Re: ICMP ping library v2.0
Post by: Federico0 on Jun 17, 2013, 10:50 am
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.
Title: Re: ICMP ping library v2.0
Post by: omkardokur on Jul 28, 2014, 10:10 pm
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)'
Title: Re: ICMP ping library v2.0
Post by: nazerisami on Jun 08, 2015, 07:06 am
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.


خیلی ممنونم اگر زودتر جواب بدین
Title: Re: ICMP ping library v2.0
Post by: hbgabs-arduino on Feb 15, 2016, 04:09 pm
HI There

I've just installed the ICMP_Ping library from : https://github.com/BlakeFoster/Arduino-Ping.git

When trying to compile an empty sketch, I get the errors below.

Any help would be appreciated. 

Thank You.

______________________________________________________________________________________

Arduino: 1.6.7 (Windows 8), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\Gail\Documents\Arduino\libraries\ICMPPing\ICMPPing.cpp: In member function 'uint8_t ICMPPing::receiveEchoReply(byte*, uint8_t&, time_t&)':

C:\Users\Gail\Documents\Arduino\libraries\ICMPPing\ICMPPing.cpp:113:67: error: invalid conversion from 'uint8_t* {aka unsigned char*}' to 'uint16_t {aka unsigned int}' [-fpermissive]

  W5100.read_data(socket, (uint8_t *)buffer, header, sizeof(header));

                                                                   ^

In file included from C:\Users\Gail\Documents\Arduino\libraries\ICMPPing\ICMPPing.h:12:0,

                 from C:\Users\Gail\Documents\Arduino\libraries\ICMPPing\ICMPPing.cpp:10:

C:\Program Files (x86)\Arduino\libraries\Ethernet\src/utility/w5100.h:142:8: error:   initializing argument 2 of 'void W5100Class::read_data(SOCKET, uint16_t, volatile uint8_t*, uint16_t)' [-fpermissive]

   void read_data(SOCKET s, volatile uint16_t src, volatile uint8_t * dst, uint16_t len);

        ^

C:\Users\Gail\Documents\Arduino\libraries\ICMPPing\ICMPPing.cpp:119:75: error: invalid conversion from 'uint8_t* {aka unsigned char*}' to 'uint16_t {aka unsigned int}' [-fpermissive]

  W5100.read_data(socket, (uint8_t *)buffer, (uint8_t *)&echoReply, dataLen);

                                                                           ^

In file included from C:\Users\Gail\Documents\Arduino\libraries\ICMPPing\ICMPPing.h:12:0,

                 from C:\Users\Gail\Documents\Arduino\libraries\ICMPPing\ICMPPing.cpp:10:

C:\Program Files (x86)\Arduino\libraries\Ethernet\src/utility/w5100.h:142:8: error:   initializing argument 2 of 'void W5100Class::read_data(SOCKET, uint16_t, volatile uint8_t*, uint16_t)' [-fpermissive]

   void read_data(SOCKET s, volatile uint16_t src, volatile uint8_t * dst, uint16_t len);

        ^

exit status 1
Error compiling.
Invalid library found in C:\Program Files (x86)\Arduino\libraries\Arduino-Ping-master: C:\Program Files (x86)\Arduino\libraries\Arduino-Ping-master

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Title: Re: ICMP ping library v2.0
Post by: flexcon on Nov 12, 2017, 09:28 pm
hi,
can i do a IP range scan?
Title: Re: ICMP ping library v2.0
Post by: mikeluken on Jul 29, 2018, 10:28 pm
It looks like the ICMPPing library no longer works with the new Ethernet library 2.0 that was released a few days ago.  I am now getting these messages:

ICMPPing.cpp: In member function Status ICMPPing::sendEchoRequest(const IPAddress&, const ICMPEcho&)
 
ICMPPing.cpp: 184:11: error: 'class W5100Class' has no member named 'send_data_processing
   W5100.send_data_processing(_socket, serialized, sizeof(ICMPEcho))
ICMPPing.cpp: In member function void ICMPPing::receiveEchoReply(const ICMPEcho&, const IPAddress&, ICMPEchoReply&)
 
ICMPPing.cpp: 207:19: error: 'class W5100Class' has no member named 'getRXReceivedSize
   if (W5100.getRXReceivedSize(_socket) < 1)
Error compiling libraries
 
ICMPPing.cpp: 219:9: error: 'class W5100Class' has no member named 'read_data
   W5100.read_data(_socket, (uint16_t) buffer, ipHeader, sizeof(ipHeader))
Build failed for project 'SecuritySystem'
 
ICMPPing.cpp: 229:9: error: 'class W5100Class' has no member named 'read_data
   W5100.read_data(_socket, (uint16_t) buffer, serialized, dataLen)
Title: Re: ICMP ping library v2.0
Post by: rainwulf on Dec 06, 2018, 07:54 am
Yea same issue here, had to revert to an older ethernet library.
Title: Re: ICMP ping library v2.0
Post by: orichienal on Mar 06, 2019, 03:15 pm
me too, and revert to an older ethernet library is not an option


post my problem in this topic
https://forum.arduino.cc/index.php?topic=573949.0
 (https://forum.arduino.cc/index.php?topic=573949.0)
who lands here then finds the solution