Generally, I have some Java code that listens on a simple TCP socket (ServerSocket). Nothing special about it, it's basically the code from any simple java server example you can find online. Everything was working as expected on CM11. It runs on two Nexus 5 phones, configured for and Ad-Hoc connection between them.
However, once I migrated to CM12 (and tested CM13 as well) and tested the same server socket, a connection can no longer be established. The server socket on the phone starts Okay and appears to be listening and waiting for a client connection, but when trying from a client (tested with C and Java test programs), I get ENETUNREACHABLE as the fail code. It's the same fail code as if the server port isn't even open.
I CAN create a TCP socket using C with (socket.c), and it can be connected to from a C client. Netcat also establishes a connection fine, with nc as client as server.
I disabled SELinux in the kernel but that wasn't the culprit.
In Addition, the network interface (wlan0) connects to an Ad-Hoc network using iw (Wifi is off in the Android Settings). If instead, I turn on Wifi in the Android Settings and connect through a routher AP, everything works fine.
Also, I'm running olsrd, which seems to start up okay, but when I run tcpdump, there are no UDP routing packets appearing. Running olsrd with '-d 3' shows everything is fine though, with the exception of the lack of visible OLSR nodes (would be there if the UDP packets were going out).
It seems like there is something that was introduced in Lollipop (5.0) that requires networks to be configured through the Java API, rather than 'externally', in order for Java sockets to work properly.
I'm resorting to diffing CM11 vs CM12 code right now, so if there's any thoughts, it'd be appreciated.
However, once I migrated to CM12 (and tested CM13 as well) and tested the same server socket, a connection can no longer be established. The server socket on the phone starts Okay and appears to be listening and waiting for a client connection, but when trying from a client (tested with C and Java test programs), I get ENETUNREACHABLE as the fail code. It's the same fail code as if the server port isn't even open.
I CAN create a TCP socket using C with (socket.c), and it can be connected to from a C client. Netcat also establishes a connection fine, with nc as client as server.
I disabled SELinux in the kernel but that wasn't the culprit.
In Addition, the network interface (wlan0) connects to an Ad-Hoc network using iw (Wifi is off in the Android Settings). If instead, I turn on Wifi in the Android Settings and connect through a routher AP, everything works fine.
Also, I'm running olsrd, which seems to start up okay, but when I run tcpdump, there are no UDP routing packets appearing. Running olsrd with '-d 3' shows everything is fine though, with the exception of the lack of visible OLSR nodes (would be there if the UDP packets were going out).
It seems like there is something that was introduced in Lollipop (5.0) that requires networks to be configured through the Java API, rather than 'externally', in order for Java sockets to work properly.
I'm resorting to diffing CM11 vs CM12 code right now, so if there's any thoughts, it'd be appreciated.
from xda-developers http://ift.tt/28X0Zzk
via IFTTT
No comments:
Post a Comment