I'm trying to listen on a port using ServerSocket on an Android device. I want to be able to connect to this port over WiFi using a computer on the same network.
I get no exception when binding it to a port, however when I check netstat it says:
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 (null):4040 (null):* LISTEN
I've tried countless ways of binding it to localhost, 0.0.0.0, the WiFi LAN IP address of the device with SocketInetAddress and InetAddress.getByName. Nothing seems to work.
When I try to connect to the port from a computer in the same WiFi (I've tried both netcat and Java's Socket.connect()), all I can see in Wireshark is an ARP request:
Who has [phone's LAN address]? Tell [computer LAN address].
This request repeat itself until timed out.
I've tried the reverse way, by setting the ServerSocket on the computer and connecting to that port from the phone, that works very well.
My testing phone is an Samsung Spica i5700 with a custom ROM.
Any ideas?
In order to get the Shift to associate with my AP, I need to change the first 2 digits of the WiFi MAC Address to 00 or the router will not accept the device and there is no DHCP lease.
When I remove all saved WiFi entries and run:
ip set eth0 address 00:12:34:56:78:90
to spoof the MAC for example, I can see using the 'ip show' command that it was indeed changed. However when I try to reassociate with any access point (open or not) then I can not connect. The only reason I can think of why this isn't working is because I am not using an engineering hboot.
Does anyone know a workaround for this? Many r outers will not accept the first 6 characters of the mac because it looks invalid. This is with root ofcourse running CM7 with the latest busybox.
Thanks!
I'm having the same problem right now - when I change MAC in my Galaxy S and try connecting to my home router it stops at authenticating and then disconnects.
Router is configured to WPA2-PSK (but with WEP also doesnt work), MAC filtering disabled.
Any ideas?
Here is basically a run-down of what I did. I hope this helps everyone out.
Device specs:
Samsung Galaxy Player 4.0 Rooted
Network Specs:
DSL Modem
Router (DHCP with WPA security and does not have MAC Filtering)
4 Access Points (all on same channel broadcasting same SSID with same WPA security DHCP)
2 Servers - Static IPs
-Server 1 - DNS (not sure if it is actually a DNS server or just forwards the requests). Also storage/application server.
-Server 2 - Storage/Application/SQL server
Many clients on network (unsure of total amount but somewhere around 30 would be my guess)
Problem (note this is only on this network, every other network wifi
works just fine):
Wifi Connected but no internet.
My Windows 7 laptop (same network) gets internet access with no problems
No reports of any other clients on the network having this issue
Device has assigned a good DHCP IP address
Subnet, Gateway, and DNS IPs are all correct (they match the ones on my laptop)
Connection strength is great (speed is 52mbps)
Device has full local access (intranet). It can access all files and other devices on the network.
On occasion the device will get "internet" access for a brief period of time but will go back to "intranet" access only after a few minutes.
Tests Performed (My android device will be referred to as "device" my laptop will be reffered to as "laptop". All tests were performed with both laptop and device connected to the network in question, unless otherwise specified, and device was not able to access internet):
Ping from laptop to device - Successful
Ping from device to laptop - Successful
Ping from laptop to gateway - Successful
Ping from device to gateway - Failed
Resolve DNS IP on device - Successful
Resolve DNS IP on laptop - Successful
Ping from laptop to google - Successful
Ping from device to google - Failed
Small FTP file transfer from laptop to device - Successful
Small FTP file transfer from device to laptop - Successful
Device has no problems on other networks (tried un-secured, WEP, and WPA/WPA2)
Connect device using Google public DNS servers
-Intranet - Successful
-Internet - Failed
-Resolve DNS IP - Successful
Connect laptop using Google public DNS servers
-Intranet - Successful
-Internet - Successful
-Resolve DNS IP - Successful
More that I cannot remember right now. Will add as they come to me.
At this point I gave up for a few days. Every test and every bit of research returned nothing. I had spent many many hours trying to figure this out and testing theories and nothing ever pointed me in the right direction of where to go. Nothing made sense EVERY single setting is the same is on my laptop. Started thinking maybe there was something in the router that could be blocking Android devices (since it is a work network). Although I am not a aware of a router feature to do that I figure I would try some more tests.
Testing Round 2 (same conditions as initial tests):
Configured laptop to be a Wifi hotspot.
-From CMD command 1: netsh wlan set hostednetwork mode=allow ssid=AP key=XXXXXXXXX
-From CMD command 2: netsh wlan start hostednetwork
-From network and sharing center: Shared the physical wireless network connection with the Microsoft Virtual WiFi Miniport Adapter.
-The above commands create a virtual wireless adapter and set it broadcast the specified SSID with the specified WPA security key. Then you can choose any available, connected, physical, internet connection and share it's internet connection with the virtual connection, thus theorectically turning my laptop into a 5th access point on the network.
Connected device to the SSID "AP"
-Intranet - Successful
-Internet - SUCCESSFUL
Horray!!!! Progress! So with the above information I went to our IT guy and we sat down and looked at some stuff (settings in the router, access points, and servers). After digging and digging around within the settings we came up with.... you guessed it NOTHING!!!!!!!!!!!!! Now I was in "Its on!" mode and decided I wasn't going to stop until I found out at least what was causing the problem. My IT guy was also very determined to figure this out as he doesn't like to get beat either. So we both went at it. We decided the first thing to do was make a very detailed network map containing every piece of information we could possibly find. We did this all from his machine (laptop with Windows 7) and wrote everything down on paper (we even used a piece of our 36" wide roll paper from our plotter to make sure everything would fit) and made an excel spredsheet with all the info. Now with the newly aquired network information I decided I was going to do more testing.
Testing Round 3 (same conditions as initial test):
Map the entire network again gathering every piece of information possible just like before but this time using MY DEVICE (not my laptop).
Compare
Finally! I have found the problem! As stated before my device was getting the correct gateway IP (XXX.XXX.XXX.1) which is the same as my laptop). However the assigned MAC address OF THE GATEWAY (router) to my device is XX:XX:XX:XX:XX:FB but the MAC address OF THE GATEWAY (router) to my laptop is XX:XX:XX:XX:XX:FA. Got back with our IT guy and we found (by looking the router config) that the XX:XX:XX:XX:XX:FA is the LAN MAC address for the router. The XX:XX:XX:XX:XX:FB is the WAN MAC address for the router.
Testing Round 4 (same conditions as intial test):
Connected laptop to network, confirmed XX:XX:XX:XX:XX:FA MAC address was assigned for the gateway by running "arp -a" in CMD.
-Pinged google - Passed
-Changed assigned MAC address of gateway by running "arp -s XXX.XXX.XXX.1 XX:XX:XX:XX:XX:FB" in CMD
-Verified new MAC address assignment by running "arp -a" in CMD
-Pinged google - Failed
-Changed the MAC back and pinged google again - Successful
Connected device to network, confirmed XX:XX:XX:XX:XX:FB MAC address was assigned for the gateway by running "arp -a" in Terminal.
-Pinged google - Failed
-Changed assigned MAC address of gateway by running "su" then "arp -s XXX.XXX.XXX.1 XX:XX:XX:XX:XX:FA" in Terminal
-Verified new MAC address assignment by running "arp -a" in Terminal
-Pinged google - Successful
-Changed the MAC back and pinged google again - Failed
Conclusion:
For some reason the device is getting assigned the correct gateway IP but the wrong gateway MAC. This is allowing the device to connect to the network but not communicate with the router. Since it can't communicate with the router any "Internet" requests time out because the packets have to go through the router to make it to the "Internet". Since it is not blocked from the network it can still connect and communicate with other clients on the "Intranet" but not the router.
Our IT guy thinks there is a client somewhere on the network in the same subnet that is configured in this matter and it just so happens that for some reason my device is picking that up when it connects. He is going to look into it more when time permits but since we are very busy and we have already spent way too much time on this, and I now know at least what the issue is, he is going to move on for now.
Why would my device be picking up the WAN MAC address of the router?
What would be responsible for assigning a WAN or LAN MAC address?
How can I prevent this?
Has anyone ever experienced anything like this?
Temporary Solution (must be rooted):
Open your favorite terminal app on your device.
-Enter "su" (without quotes)
-Enter "arp -s [Your gateway IP here] [Your gateway's LAN MAC address here]
Browse away!!!!!
Hello.
I had the same problem, that I could connect to router but had no connection to internet.
Read this post and started to do some research on my router. When I configurated my router, there was an option to clone MAC address. And of course to get it done fast I cloned MAC. And now I checked that it cloned my laptop MAC. Changed MAC from laptop to Routers MAC (must be on label under router) and got a really nice internet connection.
Hi, I think I have the same problem with the same device, Samsung Galaxy Player 4, but even if my device is rooted I still can't excecute the "arp" command from the Terminal application (there is no "arp" command). How can I check/modify the arp list on my device???
I really appreciate your help. Thanks in advance!!!
I use the terminal emulator app. It works just fine for me and I never had to download any other software to be able to run the ARP command.
bmx0964 said:
Here is basically a run-down of what I did. I hope this helps everyone out.
Temporary Solution (must be rooted):
Open your favorite terminal app on your device.
-Enter "su" (without quotes)
-Enter "arp -s [Your gateway IP here] [Your gateway's LAN MAC address here]
Browse away!!!!!
Click to expand...
Click to collapse
anyone found a solution to this ?
just updated to ics4 and cannot connect to the internet.
You only have one device that assigns IP adresses, right?
How about changing the channel to see if that works? or maybe even the security protocol
greeky510 said:
You only have one device that assigns IP adresses, right?
How about changing the channel to see if that works? or maybe even the security protocol
Click to expand...
Click to collapse
the only thing that worked for me is to turn on the dhcp option
in my router. previously, i was using static ips
may_east said:
the only thing that worked for me is to turn on the dhcp option
in my router. previously, i was using static ips
Click to expand...
Click to collapse
I had the sams problem. I could connect with my wifi but had no internet acces. The solution here was the wifi encription.
My smartphone could not encript the hard encription I think. With WEP encription it all works well.
Hey guys,
Here's a run down of the problem I'm currently having. A few months ago I purchased a Dapeng A75 currently running ICS 4.0. Although a beautiful and fast phone, just recently it started going out of wack.
- Youtube and Play Store hang on "Loading" screen
- My Gmail accounts won't sync
- I can no longer search on Google.com with ANY browser through WiFi. (I do not have data service on my phone)
I've tried several attempts at troubleshooting this, all which have failed.
- I restored my phone to factory default.
- Uninstalled and reinstalled these apps.
- Downgraded the apps to previous versions.
- Cleared my cache on just about everything.
- Release and renewed my IP in Terminal.
Just recently I noticed a CWM recovery image posted and I figure this is the only solution. Wiping out the phone and flashing a fresh ROM but unfortunately I can only get as far as installing the drivers to my Windows 7 machine. Some reason when I plug the phone in after installing the drivers, Windows will prompt me that the device is plugged in but before I get a chance to hit F9 for SP Flash Tool to do it's thing, the device quickly disconnects.
NOTE: I am able to browse Google via WiFi only by using HotSpot Shield VPN (Which is problematic in itself).
I'm currently losing the battle with this phone and at my wits end. Is there anyone out there who is experiencing the same situation or has some sort of solution which doesn't involve be shelling out more money for a new phone?
good work brother
i understood the above problem n i too experienced the same problems so now i will take ur research to next level n see my know of network .
i appreciate all the work done you , in research of this LITTLE but hetic problem.
i have learned a lot through u r research.
n will do more n keep u guys posted if i found somthing on this
---------- Post added at 11:11 AM ---------- Previous post was at 11:06 AM ----------
bmx0964 said:
Here is basically a run-down of what I did. I hope this helps everyone out.
Device specs:
Samsung Galaxy Player 4.0 Rooted
Network Specs:
DSL Modem
Router (DHCP with WPA security and does not have MAC Filtering)
4 Access Points (all on same channel broadcasting same SSID with same WPA security DHCP)
2 Servers - Static IPs
-Server 1 - DNS (not sure if it is actually a DNS server or just forwards the requests). Also storage/application server.
-Server 2 - Storage/Application/SQL server
Many clients on network (unsure of total amount but somewhere around 30 would be my guess)
Problem (note this is only on this network, every other network wifi
works just fine):
Wifi Connected but no internet.
My Windows 7 laptop (same network) gets internet access with no problems
No reports of any other clients on the network having this issue
Device has assigned a good DHCP IP address
Subnet, Gateway, and DNS IPs are all correct (they match the ones on my laptop)
Connection strength is great (speed is 52mbps)
Device has full local access (intranet). It can access all files and other devices on the network.
On occasion the device will get "internet" access for a brief period of time but will go back to "intranet" access only after a few minutes.
Tests Performed (My android device will be referred to as "device" my laptop will be reffered to as "laptop". All tests were performed with both laptop and device connected to the network in question, unless otherwise specified, and device was not able to access internet):
Ping from laptop to device - Successful
Ping from device to laptop - Successful
Ping from laptop to gateway - Successful
Ping from device to gateway - Failed
Resolve DNS IP on device - Successful
Resolve DNS IP on laptop - Successful
Ping from laptop to google - Successful
Ping from device to google - Failed
Small FTP file transfer from laptop to device - Successful
Small FTP file transfer from device to laptop - Successful
Device has no problems on other networks (tried un-secured, WEP, and WPA/WPA2)
Connect device using Google public DNS servers
-Intranet - Successful
-Internet - Failed
-Resolve DNS IP - Successful
Connect laptop using Google public DNS servers
-Intranet - Successful
-Internet - Successful
-Resolve DNS IP - Successful
More that I cannot remember right now. Will add as they come to me.
At this point I gave up for a few days. Every test and every bit of research returned nothing. I had spent many many hours trying to figure this out and testing theories and nothing ever pointed me in the right direction of where to go. Nothing made sense EVERY single setting is the same is on my laptop. Started thinking maybe there was something in the router that could be blocking Android devices (since it is a work network). Although I am not a aware of a router feature to do that I figure I would try some more tests.
Testing Round 2 (same conditions as initial tests):
Configured laptop to be a Wifi hotspot.
-From CMD command 1: netsh wlan set hostednetwork mode=allow ssid=AP key=XXXXXXXXX
-From CMD command 2: netsh wlan start hostednetwork
-From network and sharing center: Shared the physical wireless network connection with the Microsoft Virtual WiFi Miniport Adapter.
-The above commands create a virtual wireless adapter and set it broadcast the specified SSID with the specified WPA security key. Then you can choose any available, connected, physical, internet connection and share it's internet connection with the virtual connection, thus theorectically turning my laptop into a 5th access point on the network.
Connected device to the SSID "AP"
-Intranet - Successful
-Internet - SUCCESSFUL
Horray!!!! Progress! So with the above information I went to our IT guy and we sat down and looked at some stuff (settings in the router, access points, and servers). After digging and digging around within the settings we came up with.... you guessed it NOTHING!!!!!!!!!!!!! Now I was in "Its on!" mode and decided I wasn't going to stop until I found out at least what was causing the problem. My IT guy was also very determined to figure this out as he doesn't like to get beat either. So we both went at it. We decided the first thing to do was make a very detailed network map containing every piece of information we could possibly find. We did this all from his machine (laptop with Windows 7) and wrote everything down on paper (we even used a piece of our 36" wide roll paper from our plotter to make sure everything would fit) and made an excel spredsheet with all the info. Now with the newly aquired network information I decided I was going to do more testing.
Testing Round 3 (same conditions as initial test):
Map the entire network again gathering every piece of information possible just like before but this time using MY DEVICE (not my laptop).
Compare
Finally! I have found the problem! As stated before my device was getting the correct gateway IP (XXX.XXX.XXX.1) which is the same as my laptop). However the assigned MAC address OF THE GATEWAY (router) to my device is XX:XX:XX:XX:XX:FB but the MAC address OF THE GATEWAY (router) to my laptop is XX:XX:XX:XX:XX:FA. Got back with our IT guy and we found (by looking the router config) that the XX:XX:XX:XX:XX:FA is the LAN MAC address for the router. The XX:XX:XX:XX:XX:FB is the WAN MAC address for the router.
Testing Round 4 (same conditions as intial test):
Connected laptop to network, confirmed XX:XX:XX:XX:XX:FA MAC address was assigned for the gateway by running "arp -a" in CMD.
-Pinged google - Passed
-Changed assigned MAC address of gateway by running "arp -s XXX.XXX.XXX.1 XX:XX:XX:XX:XX:FB" in CMD
-Verified new MAC address assignment by running "arp -a" in CMD
-Pinged google - Failed
-Changed the MAC back and pinged google again - Successful
Connected device to network, confirmed XX:XX:XX:XX:XX:FB MAC address was assigned for the gateway by running "arp -a" in Terminal.
-Pinged google - Failed
-Changed assigned MAC address of gateway by running "su" then "arp -s XXX.XXX.XXX.1 XX:XX:XX:XX:XX:FA" in Terminal
-Verified new MAC address assignment by running "arp -a" in Terminal
-Pinged google - Successful
-Changed the MAC back and pinged google again - Failed
Conclusion:
For some reason the device is getting assigned the correct gateway IP but the wrong gateway MAC. This is allowing the device to connect to the network but not communicate with the router. Since it can't communicate with the router any "Internet" requests time out because the packets have to go through the router to make it to the "Internet". Since it is not blocked from the network it can still connect and communicate with other clients on the "Intranet" but not the router.
Our IT guy thinks there is a client somewhere on the network in the same subnet that is configured in this matter and it just so happens that for some reason my device is picking that up when it connects. He is going to look into it more when time permits but since we are very busy and we have already spent way too much time on this, and I now know at least what the issue is, he is going to move on for now.
Why would my device be picking up the WAN MAC address of the router?
What would be responsible for assigning a WAN or LAN MAC address?
How can I prevent this?
Has anyone ever experienced anything like this?
Temporary Solution (must be rooted):
Open your favorite terminal app on your device.
-Enter "su" (without quotes)
-Enter "arp -s [Your gateway IP here] [Your gateway's LAN MAC address here]
Browse away!!!!!
Click to expand...
Click to collapse
i would like to add if u have seen the
cmd-ncpa.cpl-ipv4-propreties- in this section u see its Dhcp so all fields are inactive
but u can see gateway ip which is inactive such as in my case 192.168.1.1
u cannot remove that.
any body saw the reply....
thanks regards
bmx0964 said:
Temporary Solution (must be rooted):
Open your favorite terminal app on your device.
-Enter "su" (without quotes)
-Enter "arp -s [Your gateway IP here] [Your gateway's LAN MAC address here]
Browse away!!!!!
Click to expand...
Click to collapse
Thanks, This Solution Saved me Today
Hi everybody,
I have a problem with the ethernet connection in the Samsung Galaxy Tab 4 8' WiFi (SM-T330).
I need to connect the tablet to a embedded system through ethernet with a static IP address, and in order to achieve this I use a MicroUSB-RJ45 adapter that in android 4.4.2 works perfectly fine, but when I upgraded to android 5.1.1 the ethernet connection stopped working.
A key requirement I have is that the IP address must be static. This is important because making some research I've connected the tablet to a LAN and with ethernet configured as DHCP and I have internet connection, but when I change the configuration of the connection to a static IP I can't even make ping to the gateway. If I execute in a terminal emulator the command 'netcfg' I can see the interface eth0 up with the correct IP assigned (192.168.1.98). If I run the command 'ip route show' I can see the following in the output:
default via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.98
Which is apparently correct IMO, but the fact is that if I ping the 192.168.1.1 address I get "Network is unreachable" error.
Just to compare, the output of 'netcfg' and 'ip route show' in case of DHCP configuration is pretty much the same:
default via 192.168.1.1 dev eth0 metric 238
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.179 metric 238
But this time everything works fine.
I have no clue why it doesn't work with a static IP. Can anybody help me with this issue? I'm doing something wrong, or this is an android 5.1.1 bug?
Thanks in advance.
pazonks said:
Hi everybody,
I have a problem with the ethernet connection in the Samsung Galaxy Tab 4 8' WiFi (SM-T330).
I need to connect the tablet to a embedded system through ethernet with a static IP address, and in order to achieve this I use a MicroUSB-RJ45 adapter that in android 4.4.2 works perfectly fine, but when I upgraded to android 5.1.1 the ethernet connection stopped working.
A key requirement I have is that the IP address must be static. This is important because making some research I've connected the tablet to a LAN and with ethernet configured as DHCP and I have internet connection, but when I change the configuration of the connection to a static IP I can't even make ping to the gateway. If I execute in a terminal emulator the command 'netcfg' I can see the interface eth0 up with the correct IP assigned (192.168.1.98). If I run the command 'ip route show' I can see the following in the output:
default via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.98
Which is apparently correct IMO, but the fact is that if I ping the 192.168.1.1 address I get "Network is unreachable" error.
Just to compare, the output of 'netcfg' and 'ip route show' in case of DHCP configuration is pretty much the same:
default via 192.168.1.1 dev eth0 metric 238
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.179 metric 238
But this time everything works fine.
I have no clue why it doesn't work with a static IP. Can anybody help me with this issue? I'm doing something wrong, or this is an android 5.1.1 bug?
Thanks in advance.
Click to expand...
Click to collapse
how to you connect tablet with LAN cable?
thelous said:
how to you connect tablet with LAN cable?
Click to expand...
Click to collapse
They said (and I quote):
in order to achieve this I use a MicroUSB-RJ45 adapter that in android 4.4.2 works perfectly fine, but when I upgraded to android 5.1.1 the ethernet connection stopped working.
Click to expand...
Click to collapse
thisisapoorusernamechoice said:
They said (and I quote):
Click to expand...
Click to collapse
Ohh i thought he mean tab 4 8.0 had ethernet port LOL., but why use LAN cable whek you can get same speed with wifi? Atleast i am getting same speed on tablet as i have on desktop computer....
I believe I am having the same problem. Any word on what is going on?
I was able to get UDP messages out to work intermittently by finding a network that it would connect with and then connecting it back into the network I wanted it to work with. I could not get the initial connection consistently, though.
I was able to get everything working again by flashing 4.4.2 onto the tablet, factory resetting, not letting anything update, and setting up my Ethernet network.
Hi,
I want to connect few phones to ethernet network via USB ASIX AX88772B adapter. Some devices can connect without any problems, some need to install xposed and Fake WiFi module. And some... can't! They all have OTG support and drivers for this network card. All phones get IP from DHCP, on all DNSs are set to 8.8.8.8 and 8.8.4.4, all have the same gateway. On all devices traceroute and nslookup works properly, but on some doesn't work ping and internet generally. It looks like Android can't see internet connection. Even with Fake WiFi. I also tried to set IP of rmnet0 to 0.0.0.0, but it didn't help. This is steps which I'm doing:
Install xposed, fake wifi and turn it on
Plug ethernet card
Dhcpcd eth0
setprop net.dns1 8.8.8.8 and for second dns 8.8.4.4
route add default gw xxx.xxx.xxx.xxx dev eth0
Testing with nslookup, traceroute, ping
Did you have the same problem? I noticed that all LG Phones have this problem, and HTC ONE Max (I didn't test on other HTCs). Could you help me?