I am working on an application that checks, before enabling a download, that the connection is reliable (basically the connection should be an infrastructure wifi and not data pack) But in case the user is either
and then connecting and starting the download on desktop, it is still undesired. Is there a way to detect if some wifi connection is actually not from ad hoc or using phone's WAP?
In infrastructure mode, all devices on a wireless network communicate with each other through an access point (wireless router). In ad hoc mode, a computer with a wireless network adapter communicates directly with a printer equipped with a wireless print server.
In fact, Wi-Fi access points work in either ad hoc or infrastructure mode. Typically, Wi-Fi networks in infrastructure mode are created and managed using equipment such as Wi-Fi routers, wireless access points (WAPs) and wireless controllers.
A typical example of an ad-hoc network is connecting two or more laptops (or other supported devices) to each other directly without any central access point, either wirelessly or using a cable. When to use an ad-hoc network: If you want to quickly set up a peer-to-peer (P2P) network between two devices.
You can detect...
...the usage of a phone access point by measuring the round-trip time of a request - they are usually quite high on mobile broadband.
long start = System.nanoTime();
HttpGet requestForTest = new HttpGet("http://m.google.com");
try {
new DefaultHttpClient().execute(requestForTest); // can last...
}
catch (Exception e) {
}
long rtt = System.nanoTime() - start;
// ... evaluate the rtt
This table may be relevant for the evaluation (source)
Generation | Data rate | Latency
2G | 100–400 Kbit/s | 300–1000 ms
3G | 0.5–5 Mbit/s | 100–500 ms
4G | 1–50 Mbit/s | < 100 ms
Apart from those two options: why do you specifically ban Ad-Hoc or mobile broadband? Shouldn't you either
or
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With