Hello Folks,
My name is Héctor and this is my first post. I have a basic understanding of java and some experience with VB.
For my socket client app, I am trying to change the three parameters mention on the subject.
By means of Reflection, I was able to enable the keepalive in my socket.
I was able to change TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT at Android level using adb shell. The effect is for all sockets until the next Andriod recycle
Now I want to change from within my B4A app and just for my session. Searching for it I have found a class -android.system.Os- that has the method "public static void setsockoptInt(FileDescriptor fd, int level, int option, int value)" that should allow me to do what I need.
The problem is that this class cannot be instantiated and I dont know if that is possible with reflection.
Does anyone have an idea to deal with this? I havent seen B4A JavaObject because I am trying to stick to Reflection.
Best Regards.
Hector.
My name is Héctor and this is my first post. I have a basic understanding of java and some experience with VB.
For my socket client app, I am trying to change the three parameters mention on the subject.
By means of Reflection, I was able to enable the keepalive in my socket.
B4X:
Dim ClientApp As Socket
Dim r as Reflector
ClientApp.Connect("192.168.1.8",10003, 500)
r.Target = ClientApp
r.Target = r.GetField("socket")
r.RunMethod2("setKeepAlive", True, "java.lang.boolean")
I was able to change TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT at Android level using adb shell. The effect is for all sockets until the next Andriod recycle
B4X:
echo 60 > /proc/sys/net/ipv4/tcp_keepalive_time
# echo 10 > /proc/sys/net/ipv4/tcp_keepalive_intvl
# echo 5 > /proc/sys/net/ipv4/tcp_keepalive_probes
Now I want to change from within my B4A app and just for my session. Searching for it I have found a class -android.system.Os- that has the method "public static void setsockoptInt(FileDescriptor fd, int level, int option, int value)" that should allow me to do what I need.
The problem is that this class cannot be instantiated and I dont know if that is possible with reflection.
Does anyone have an idea to deal with this? I havent seen B4A JavaObject because I am trying to stick to Reflection.
Best Regards.
Hector.