I was looking for a solution for sending Ping requests with monotouch, and have read a lot about it.
So from what I understood the base problem for implemting a Ping request on monotouch is that it requires the create a socket with raw access and that's not an option as it requires to have root access.
So that's why the
System.Net.NetworkInformation.Ping is not available for monotouch (nor it is for Silverlight)
So there is NO WAY having a real Ping implementation with monotouch, have to fallback to the reachability classes...
BUT, in my further readings I've found the sample from Apple implementing Ping request in Cocoa/objc and in the readme, found a interesting precision :
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. Look at the -[SimplePing startWithHostAddress] method for the details.
Oh then that's nice, we actually CAN open a socket for sending ICMP request on iOs!!
So I went looking for a pure C# implementation of ICMP request and found a really interesting reading about pure socket programming and it came along with its sources
So, I brought them down, created a monotouch project, launched a ping request and... FAILURE : access denied... but that was expected.
So I changed that line (RawSocketPing.cs at line 177) :
pingSocket = new Socket(destEndPoint.AddressFamily, SocketType.Raw, ProtocolType.Icmp);
to that :
pingSocket = new Socket(destEndPoint.AddressFamily, SocketType.Dgram, ProtocolType.Icmp);
And that worked like a charm.....
So! (finally) is there a way of getting a "real" Ping in monotouch ?