Hey Guys,
I need a little guidance from you.
I am developing an app that connects to a medical device(an RTOS) using a certain port over Androids Wi-Fi hotspot feature.
This is how the app works:
1) it has to find all connected network devices to the Phone.
2) ping and/or examine remote device/port to identify remote device.
3) if everything is fine get stuffs done using this connection.
I am facing problem with step 1, later steps are working fine.
My question is:
a) how do I find all Wi-Fi network devices connected to a phone?
I have read that we can connect up to 5 devices to a Wi-Fi hotspot. I can just ping 5 of them but knowing which IP address range is assigned to remote devices is important.
Since Wi-Fi works in a different layer, I cannot always rely on IP address. However given the fact that dnsmasq(andys own DHCP server) is always running, I came up with a possible solution.
Lookup arp cache in /proc. But its true that arp entries will timeout, which makes my solution unreliable at any given moment.
Here comes the other question,
b) can I ping Wi-Fi hotspot broadcast IP and wait for the remote devices to reply? I have read somewhere that network devices connected to Android hotspot won't reply back as expected, is it true?
I need to support general public who cannot root their device, so using /data is out of my option. Since I cannot re-design the remote RTOS device, sending beacon packets to Android is not an option too.
c) Is there any APIs that I can use directly?
Any help would be greatly appreciated.
how to find wi-fi hot spot connected devices??
I hav d same question as nixtalker, that how to find devices connected to our mobile hot-spot ??? is there any android apps??? plz reply.
Wifi Problem Solve
Hi buddy you can use wiifimanger class that call by Services class.
1)
WifiManager mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo mWifiInfo = mWifiManager.getConnectionInfo();
ConnectivityManager myConnManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo myNetworkInfo = myConnManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
getDeviceIpAddress();
this can give you wifi connected device IpAddresses.
Related
OK, my wife and I each have Sprint Samsung Galaxy S3's. We both have Wifi Tether TrevE mod installed and working and we also have a linksys router running DD-WRT.
I have wanted for a long time to create a stable home network with the router using our phones for internet. Reason being, We both have laptops that need access to our WiFi networked printer. And I also wanted to create a networked storage.
I started out trying to use the Router as a repeater bridge. The problem here is that in that mode there is no DHCP server in the router, so when you turn off WiFi Tether in the phone, there is no IP assignment taking place since it is handled by the phone. This is ok for the printer because we can set a static IP, but not ok for the laptops because they need to have auto ip assignment for all the other networks they might encounter. Plus I'd like to be able to have a friend come over and use the printer if need be without having to change his IP address. So this setup is unstable.
Then I tried the Router in Repeater mode. In this mode IP addresses are being assigned and everyone can see everyone else on the network. The problem here though, is that the Router and all connecting devices have to be in a separate subnet than the WiFi Tethering phone, i.e, Tethered Phone on 192.168.1.x and Router on 192.168.2.x (as far as I can tell anyway, I've tried putting them on the same subnet but fail to get internet access.) It's a problem because I have Samba Filesharing installed on the phones and the tethered phone is in a different subnet and not visible on the network. I want all devices visible.
So that's kind of where I am now, Wifi Tether on both phones (each setup with same settings so either phone can be used as our internet gateway) but they are on a separate subnet from the rest of the network while tethering.
How do I get all of my devices to be visible on the network?
Do I need a different setup in DD-WRT?
Currently it is setup in Gateway mode with DHCP server and wireless is in repeater mode with a VLAN setup with a different SSID from the WiFi tethered phone.
Do I need to usb tether the phone to the router? I have a usb port on the router but I've not found good instructions for getting the phones internet through to the router that way and I'm not sure that I would want it that way since I wouldn't be able to walk around with my phone.
Is there a way to make devices in different subnets visible to each other? Some kind of bridging or static routing or something?
Is it possible to have the phone connect to the router in a normal manner and for the router to then share the phones internet connection with the rest of the network? Then at least the router could run DHCP and be stable even without the phones.
Again, just to clarify, I want a home network with devices connecting to my WiFi router running DD-WRT and internet being provided by one of our phones, but with the network remaining intact when the internet provided phone is removed. Thanks for your help.
Bonus questions:
Is it possible to harness the power of both of our phones internet connections into one network by any means possible?
Are there any other wifi/tethering apps or another version of WiFi Tether that offer more features or the functionality of DD-WRT?
did you see this?
http://forum.xda-developers.com/showthread.php?t=1548844
pbmurdoc said:
did you see this?
http://forum.xda-developers.com/showthread.php?t=1548844
Click to expand...
Click to collapse
Thanks. Not much new there other than Barnacle. Didn't know about it, tried it, doesn't work on my phone. I would like to see a version of WiFi Tether with some more options though, why couldn't we have one with the same options as DD-WRT?
I did some more reading and I think what I need to do is link the subnet created by the router to the primary router (the phone serving Wifi Tether) through static routing. Unfortunately the static route needs to be done through the primary router and WiFi Tether doesn't include features like that.
I'll do some more experimenting and see what happens.
[A] Cellular Phone/USB Modem As WAN Connection
Answer is in the DD-WRT Wiki, here (http://www.dd-wrt.com/wiki/index.php/Cellular_Phone/USB_Modem_as_WAN_connection).
Or just google "DD-WRT Cellular Phone/USB Modem As WAN Connection", it should be the #1 result.
Their WIKI is a great resource.
Good luck!
EDIT:
In retrospect, I am unsure about linking to the DD-WRT site... external and all. If this is a no-no just let me know and I will delete the link.
DD-WRT Client Bridge worked for me
I was able to do what you're trying to do by configuring my DD-WRT router as a Client Bridge.
I can't post the link, but there are directions I followed exactly on the DD-WRT wiki in the section:
DD-WRT wiki mainpage / Linking Routers / Client Bridged
I'm connecting my router to the tether via wifi, and connecting my wired devices to the router. I haven't had it working long, but so far it has been great.
Got it, sort of
Just to update this thread. The client bridge is a great way to connect a wired network to the bridge but loses out on creating a stable wi-fi network when the phone tether is turned off.
Anyway, the final setup I managed was having the DD-WRT router set as a wireless repeater with a computer connected to it running a DHCP server. The computer takes care of the IP addreses so that we have a stable wired/wi-fi intranet when the phone is not sharing it's internet connection.
Update: I founde another solution/project based on OpenWRT
http://ofmodemsandmen.com/
my exploits using a Linksys E3000 have been documented here:
http://tweakedrom.com/forum/viewtopic.php?f=6&t=7
I kind of like the USB tether thing. The E3000 Router USB power charges and maintains my SCH-i605 (Verizon Samsung GN2) running CM12.1. I use this as a backup connection or in the event of main cable modem service disruption at the house. It is also great for traveling (hotels) or camping (car 12v adapter for router, or power inverter)
I just bought a used Asus RT-N66U router. Out of the box it supports USB tethering with android phones and dual WANs for failover/load balancing. ROOter also works, tested the x86 build on an old PC. I'm looking to cut out my ISP completely and just use 4G from the phone for internet. The issue I have run into is that I can't appear to do DDNS or port forwarding. My wireless carrier (verizon) appears to be employing a double NAT. If I perform a speedtest on the ookla app, I get 2 IP addresses in the results, an "internal" and an "external". Both are in the public range but I can't DDNS in with either of the IPs, nor can I get any kind of service working.
Anyone have a solution for this? I'm not 100% sure but I wonder if using the SIM card in a dedicated USB 4G modem (not tethering via the phone) would get me a direct IP? I suppose I could also sign up for a VPN service and run OpenVPN on the router but that'd cut down on speeds I think. I've also heard about punching holes for ports but I'm not 100% sure how that works, I assume I still need some 3rd party public IP for relaying or something.
Hello all,
I am looking for a way to run my android as a wireless router (not as an access point or a tether).
I am putting together a distributed app with components running on multiple devices. It works fine when I have the Wi-Fi enabled on my android and I have a wi-fi router to connect to, but I need to run this where I won't necessarily have the wi-fi router available.
Basically, I want to run a private network using my android as both my core app, and as a wifi-router/dhcp server, without allowing devices that connect to my android to have access to the internet through my device.
I've seen many apps and threads that all cover how to use the built-in access point, or how to configure the device as a hotspot, but these all discuss tethering and how to get past the limits (or snooping) of your provider and not how to set up a private network.
Is there a way, or an existing app that will allow me to set up a private network as I describe? If not, is there something I can do within my server code to enable the Access Point and disable Tethering at the same time?
Thanks in Advance
F.F.
Hi All,
At this point, I'm just brainstorming, and would like some input. (I hope this thread is in the right place)
I'm trying to find a setup to connect to free wifi hotspots that are far away, and share that connection to a group of devices locally. For example, this solution may be useful in a boat or an RV, when you're not particularly close to a free access point.
There are commercial solutions like the Rogue Wave however, this doesn't do anything to authenticate through the Terms of Service (TOS) pages that are frequently used at free access points.
This is what brings me to using Android. There are Android apps which automate the process of accepting the terms of service. My favorite right now is WebWifiLogin (I'm familiar with the security risks involved in using public wifi; and may also have the Android device to also establish a VPN connection when doing this.) (I can't find an equivalent macro-authentication solution that will run on a PC, which would make this much easier.)
So here's my proposed solution:
1. Start with a powerful omnidirectional wifi antenna (Possibly add an in-line amp if needed. Also perhaps a directional antenna may be better for non-mobile use.)
2. Connect the antenna to any Android device that supports an external Wifi antenna. I found several Android TV devices which should work. Like This, or possibly this.
3. Set up some kind of local access point/bridge. One option may be to use fqrouter2 which supposedly uses the same Wifi radio for the local WLAN, while it also connects to the remote one. Another option may be to USB or Ethernet tether to a DD-WRT Router.
Result:
The Android device has a range to connect to a free hotspot up to a mile or two away, then automatically accepts the TOS using the WebWifiLogin app, and shares that connection locally to a handful of devices.
So am I crazy? Is this too complex to work correctly? Is there a simpler solution that I'm missing?
Can anyone confirm whether I've posted this in the correct sub-forum?
Thanks.
I use a slightly different method which yields the same results.
I have a Linksys WRT54GL router (with high gain antennas) which runs DD-WRT and a script called AutoAP. The script scans for unencrypted WIFI access points, makes sure they're live, and automatically connects to the strongest one in range.
I set up a second WPA2 encrypted WIFI SSID in the router which I connect to with my Android tablet. Once WebWifiLogin on the tablet handles the TOS login, the remote access point allows web access for any device that connects to the WRT54GL router (either by WIFI to the secondary SSID or through one of the ports)! This happens because the remote access point usually checks/remembers TOS acceptance by the MAC address of the connected device. Since it only sees the MAC address of my router, anything behind the router now gets access.
ssenemosewa said:
Once WebWifiLogin on the tablet handles the TOS login, the remote access point allows web access for any device that connects to the WRT54GL router
Click to expand...
Click to collapse
This is great information; thanks!
I would not have thought WebWifiLogin would work when connecting through another router. When WebWifiLogin is running, its status says "Listening for WiFi events" (Or something similar) so I was under the impression that WebWifiLogin would only work if the connection to the AP is made directly by the Android WiFi interface, and not through a intermediary router.
This makes things much easier.
Hello,
I have a galaxy nexus running stock android 4.2.1 with a very peculiar problem. From time to time i have trouble accessing a certain website if i try from wifi or from mobile connection it doesn't matter. If i restart the device the website works without a problem. It was a very odd problem and kept bugging me so i tried to focus on finding the real cause. After a lot of try and error i managed to arrive at this situation:
I have at my disposal 3 different wifi networks (lets call the wifi-1,wifi-2,wifi-3) and mobile broadband connections.
after a reboot of the phone (just to have a clear state) if i connect to wifi-1,2 or mobile conn the website works OK. if i connecto to wifi-3 the site also works OK but then after i disconnect from wifi-3 and connect to any of the other wifi-1,wifi-2 or mobile conn it doesn't work anymore. If i connect to wifi-3 again it works fine on that network.
I've connected to the phone using connectbot and checked the ip address and different params. and i simply can't get a ping to that website. a similar website located in the same subnet but on a different IP still works.
So what could happen on the network layer on the phone to stop working the connection to a certain IP?
Where could i find some info about how to debug IP networking issues on android 4.2.x
PS: I control both the phone and the servers that i'm trying to reach and can't see any traffic coming from the phone on the server.
PS1: I couldn't reproduce the issue with android 4.2.2 only with 4.2.1 (i've also tested android 4.4.4 and couldn't reproduce) i've tested 2 different phones with 4.2.1 and the problem reproduces.
This seems like an issue of handshake and IP Negotiation on the phone. Please see what options you have in terms of DHCP and IPV6 Settings. Please also take a close look at the DHCP Lease time of WiFi-3.
Also Please post in Galaxy Nexus Q&A, Help & Troubleshooting so that the right experts for your device may be of help.
Thank you
Moved here http://forum.xda-developers.com/galaxy-nexus/help/networking-issue-android-4-2-1-galaxy-t2886208
IPv6 is disabled
DHCP is similarly configured on all networks. different IP classes. IP addresses change correctly every time. As i'm able to connect to everything i try except that certain website i don't think it's something related with dhcp.
Hi guys!
I have an issue with bluetooth tethering between two android phones:
A-Oneplus One cm12.1 latest nightly
B-Xperia SP cm11 latest stable release
Bluetooth tethering is activated on A, and paired up with B. Then I activate the "use internet access" option on the bluetooth pairing settings. Then when I try to access the internet on B, I get a "could not find server" error. It is not a dns issue as the problem is the same when using ip addresses.
I tried to isolate the faulty phone with two scenarios:
I connected a friend's phone running kitkat to A: internet worked fine, which led me thinking that A was sharing its connection correctly and thus B was at fault. But then I connected B to my friend's phone in bluetooth tethering mode: internet worked fine, so B can receive bluetooth tethering internet correctly...
Could it be that lollipop phones have trouble sharing bluetooth internet to kitkat phones? Seems a bit fishy to me...
Is there a command line tool (like pand on old cyanogen phones) to manually configure A or B?
Any ideas? Thank you!
Update:
I ran a netfcg on B: it showed that bt-pan didnt have any Ip address assigned.
So i did
netcfg bt-pan dhcp
ip route add default via 192.168.44.1 (A's ip address).
Now i can ping any internet IP, but I cannot ping web addresses. How do I set the correct dns in this case?
Thanks!
This post solved my problem.
forum.xda-developers.com/showthread.php?t=2043744&page=18