Open Sir-SpankalotUK opened 9 years ago
Cool find! Have a look at this @PcTim !
@Sir-SpankalotUK are you refering to this line? https://github.com/BlakeFoster/Arduino-Ping/blob/master/icmp_ping/ICMPPing.cpp#L146
Yes, I am digging further and pretty sure the TTL response value is not calculated on return, https://github.com/BlakeFoster/Arduino-Ping/blob/master/icmp_ping/ICMPPing.cpp#L192 just seems to return my initial value of 255.
I'm really not deep into C nor network protocols but we are using this library heavily on https://github.com/powtac/Autarc_LAN_User_Stats and we had different performance problems as well. But still I'm not sure whether it is regarding the network and the hardware or software.
I am trying to build a ping box with a neopixel ring, 1 led for each for server, the colour displayed shows the response time. Then the arduino can serve a small statistics web page. I have had the code running for a few days now and was surprised at the number of false positives coming back, even from network switches. So I have started to dig into the code to figure out what's going on.
Think the code will need to parse the response packet and pull apart the header to get the correct TTL value. This is where the code goes over my head. Need to read the W5100 datasheet me thinks :(
I don't remember exactly how I decided on the initial value, but for what it's worth I don't think the TTL has ever worked quite right. That could very well be the problem.
I relied heavily on the W5100 datasheet when I wrote this library. You can find it here: https://www.sparkfun.com/datasheets/DevTools/Arduino/W5100_Datasheet_v1_1_6.pdf
Thanks for the reply. As far as I can tell, my sketch is working well with TTL set to 255. Is there a chance you could amend the library to pull the correct TTL value from the header when a response happens? it should be the 9th Octet of the responses IP header. I have tried but the code is rather beyond my understanding. PS- I have tried reading that datasheet and no closer to understanding what's going on
Hi Blake,
I was browsing through the code as I seem to be getting a lot of false positives (no response). I am wondering why you settled on TTL value as 128? Line 124 of ICMPPing.cpp.
Should the initial value not be 255? as what I am reading here http://openmaniak.com/ping.php#ping-ttl A windows system will deduct 128 from the TTL value, probably the reason why I am getting a lot of false positives.
You'll have to forgive me, as your code does exceed my knowledge of C, but I am trying to grasp it.
After I have set TTL to 255, the number of false positives I am experiencing has dropped to almost nothing.
Thanks, Andrew.