Bug 964

Summary: Implementation of system.net.networkinformation.ping Class
Product: iOS Reporter: Johan Wiersma <j.wiersma17>
Component: BCL Class LibrariesAssignee: Bugzilla <bugzilla>
Status: CONFIRMED ---    
Severity: enhancement CC: baramuse, joseph, kumpera, masafa, mono-bugs+monotouch, sebastien, theonlylawislove, Xendgal
Priority: ---    
Version: 4.x   
Target Milestone: Future Cycle (TBD)   
Hardware: Other   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: socketConnect

Description Johan Wiersma 2011-09-21 12:42:11 UTC
At the moment, using system.net.networkinformation.ping class in Monotouch does not seem to be working correctly. The class can be used, code will compile and build, the code runs without errors, but it does not function correctly, e.g. ip adresses that don't exist, return a valid reply status when pinged.

Environment used:
Xcode 3.6, MonoDevelop 2.6, Mono framework 2.10.5, MonoTouch 4.0.7
Comment 1 Sebastien Pouliot 2011-09-21 13:20:14 UTC
https://bugzilla.novell.com/show_bug.cgi?id=579184

I'm unsure why Ping was added to the MonoTouch profile (it was not in Silverlight). I guess it came as a "shared" update for Mono for Android ? Anyway we should remove it from MonoTouch profile if it cannot work (like mentioned in the old bug report).
Comment 2 Sebastien Pouliot 2011-10-20 11:38:48 UTC
*** Bug 1601 has been marked as a duplicate of this bug. ***
Comment 3 Joseph Hill 2011-10-21 07:56:23 UTC
Created attachment 747 [details]
socketConnect

Customer provided alternative
Comment 4 baramuse 2012-11-21 19:35:48 UTC
I've done some research about it and it seems that that main assumption that blocks the implementation of Ping() on iOs (= the need of RAW level socket to perform a ICMP request) seems to be incorrect :

From apple documentation : 
On most platforms ping requires privileges (it's implemented with a raw IP socket). Mac OS X 10.2 and later, and all versions of iOS, include a special facility that allows you to ping without privileges. Specifically, you can open a special, non-privileged ICMP socket that allows you to send and receive pings.

Details here : http://forums.xamarin.com/discussion/410/ping-in-monotouch-icmp-requests

Regards.
Comment 5 Paul Knopf 2013-10-29 18:14:01 UTC
SimplePing, which Apple says works for iOS (and indeed it does) is now available for MonoTouch via some bindings.

https://github.com/theonlylawislove/MonoTouch.SimplePing
Comment 6 Xeonios 2014-12-27 22:26:00 UTC
The same thing is observed on Mac OS X 10.8.5 with Mono 3.10.
Comment 7 Xeonios 2014-12-27 22:38:25 UTC
The problem can be solved if you use a "sudo" command (sudo mono app.exe) in terminal, but it is not very convenient.