Wenfengcheng / xamarin-notes

xamarin journal
MIT License
3 stars 0 forks source link

Reachability #40

Open Wenfengcheng opened 5 years ago

Wenfengcheng commented 5 years ago

The Reachability sample application demonstrates how to use the System Configuration framework to monitor the network state of an iOS device. In particular, it demonstrates how to know when IP can be routed and when traffic will be routed through a Wireless Wide Area Network (WWAN) interface such as EDGE or 3G. Note: Reachability cannot tell your application if you can connect to a particular host, only that an interface is available that might allow a connection, and whether that interface is the WWAN. To understand when and how to use Reachability, read "Networking Overview". The called "reachability" we already know can only tell us the local connection status.These tools currently we know are all supported by the SCNetworkReachability API.

Now RealReachability can do this for you~

We introduce ping module for us to check the real network status, together with SCNetworkReachability API. And we use FSM(finite state machine) to control all of the network status to confirm that only status change will be sent to application.

References: https://developer.apple.com/library/archive/samplecode/Reachability/Introduction/Intro.html https://github.com/dustturtle/RealReachability