Skip to content

Commit

Permalink
Fix minor readme typos and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
georg-jung committed Dec 13, 2019
1 parent 7ad1552 commit d825018
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ PhysicalAddress mac = await Arp.LookupAsync(IPAddress.Parse("1.2.3.4"));
```


Detect if the current platform is supported. Lookups on unsupported plattforms throw `PlatformNotSupportedException`s.
To detect if the current platform is supported, check as follows. Lookups on unsupported platforms throw `PlatformNotSupportedException`s.
```C#
var linuxOrWindows = Arp.IsSupported;
```
Expand All @@ -37,7 +37,7 @@ On Windows an API call to IpHlpApi.SendARP is used. Beware that this implementat
On Linux the `/proc/net/arp` file, which contains system's the arp cache, is read. If the IP address is found there the corresponding MAC address is returned directly.
Otherwise, an ICMP ping is sent to the given IP address and the arp cache lookup is repeated afterwards. This implementation uses async file IO and the framework's async ping implementation.

Per default, the library waits for ping responses for up to 750ms on linux platforms. Technically, the responses are not required, as the arp protocol and the arp cache have nothing to do with the pings. Rather, the pings are an easy way to force the OS to figure out and provide the information we are looking for. I did not do extensive tests how long is reasonable to wait to be quite sure, the arp cache is updated. 750ms should be much more than needed in many cases - it is more of the safe option. Note that if you do recieve a ping response, the wait might be much shorter. The timeout gets relevant if the host is not available/no ping answer is received. If you want to request many addresses or are facing other time-limiting aspects, you may want to reconfigure this default:
Per default, the library waits for ping responses for up to 750ms on Linux platforms. Technically, the responses are not required, as the arp protocol and the arp cache have nothing to do with the pings. Rather, the pings are an easy way to force the OS to figure out and provide the information we are looking for. I did not do extensive tests how long is reasonable to wait to be quite sure, the arp cache is updated. 750ms should be much more than needed in many cases - it is more of the safe option. Note that if you do recieve a ping response, the wait might be much shorter. The timeout gets relevant if the host is not available/no ping answer is received. If you want to request many addresses or are facing other time-limiting aspects, you may want to reconfigure this default:

```C#
Arp.LinuxPingTimeout = TimeSpan.FromMilliseconds(125);
Expand All @@ -52,8 +52,8 @@ Arp.LinuxPingTimeout = TimeSpan.FromMilliseconds(125);
* **not** WSL 1 (tested)
* [WSL 2](https://github.com/Microsoft/WSL/issues/2279)

Note that the used method does not work in WSL 1 and might not work on every linux distribution. Checking the `Arp.IsSupported` property accounts for this (though it does not check if you are actually allowed to access `/proc/net/arp`). In WSL 2 this library will work as on most "real" linux distributions as [this issue describes](https://github.com/Microsoft/WSL/issues/2279). While I did not test this library on Android/Xamarin I have read in different places that reading `/proc/net/arp` is possible (given the right permissions).
Note that the used method does not work in WSL 1 and might not work on every Linux distribution. Checking the `Arp.IsSupported` property accounts for this (though it does not check if you are actually allowed to access `/proc/net/arp`). In WSL 2 this library will work as on most "real" Linux distributions as [this issue describes](https://github.com/Microsoft/WSL/issues/2279). While I did not test this library on Android/Xamarin I have read in different places that reading `/proc/net/arp` is possible (given the right permissions).

## Credits

The windows version is based on [nikeee/wake-on-lan](https://github.com/nikeee/wake-on-lan).
The Windows version is based on [nikeee/wake-on-lan](https://github.com/nikeee/wake-on-lan).

0 comments on commit d825018

Please sign in to comment.