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?
This is with JB 4.2.2 (Euroskank) on both:
turn on Bluetooth on Nexus 7 (N7)
turn on Bluetooth Portable Hotspot on Galaxy Nexus (GN)
pair
share internet on GN
choose to use GN for internet on N7
test it, doesn't work...
drop to root terminal on both to see what is wrong...
[email protected]:~$ netcfg
See it has IP of 192.168.44.1
[email protected]:~$ netcfg
it has a dummy IP, 169.x.x.x
[email protected]:~$ netcfg dhcp bt-pan
[email protected]:~$ netcfg
Shows that it gets 192.168.42.91 (wrong IP)
[email protected]:~$ ifconfig bt-pan 192.168.44.91
OK, IP is now good, time to check the routing..
[email protected]:~$ ip route
192.168.44.0/24 dev bt-pan proto kernel scope link src 192.168.44.91
BROKEN! Okay, let's add the default route:
[email protected]:~$ ip route add default via 192.168.44.1
check the route:
[email protected]:~$ ip route
default via 192.168.44.1 dev bt-pan
192.168.44.0/24 dev bt-pan proto kernel scope link src 192.168.44.91
Looks good, let's test it:
[email protected]:~$ ping google.com
PING google.com (74.125.226.69) 56(84) bytes of data.
64 bytes from yyz06s07-in-f5.1e100.net (74.125.226.69): icmp_seq=1 ttl=57 time=1 288 ms
Works!
But, when the GN goes to sleep, everything slows to a crawl... has to have a wake lock to keep data at a reasonable speed... why is Bluetooth tethering SO BROKEN?
Good thing my carrier blocks tethering, so all this really doesn't affect me, but for those that it does, I bet you guys are disappointed.
My device is Asus transformer with 3g. I send sequence AT commands into /dev/ttyACM0 and received IP, GW, DNS from operator. Them I used ioctl codes for assign IP, GW and bringing up interface. But I dont pinging gw: destination host unreachable. What I need to do more?
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?