I am aware that concurrent usage of WiFi and 3G/4G is not supported on Android devices right now. I am working on a research project which tries to analyse the pros and cons for the same.
I used the approach used by Android WiFi tether to reload the WiFi driver and configure the routing table and appropriate interfaces. I summarized my work in the followinglink<https://sites.google.com/site/lotuseaterarpit/news/3g4gwififorandroidconcurrently>. I tested my setup using the *"ping -I eth0/rmnet0 <web server>". * Till this phase everything is running smoothly. As a next step I tried to establish a socket connection using the two interfaces. Everything works fine as I use 3G interface, but when I try using the WiFi (eth0), socket connection is not successful. Though I can see that bind operation is successful. The code I used for this socket establishment is: *NetworkInterface nif = NetworkInterface.getByName("eth0");* * Log.d(TAG,"Interface detected S");* * Enumeration<InetAddress> nifAddresses = nif.getInetAddresses();* * Log.d(TAG,"Interface IP Address Retrieved S: ");* * Socket socket = new Socket();* * try{* * socket.bind(new InetSocketAddress(nifAddresses.nextElement(),1027));* * Log.d(TAG,"Socket Bind S");* * socket.connect(new InetSocketAddress(InetAddress.getByName("152.14.93.160"),80));* * Log.d(TAG,"Socket Creation Success");* * socket.close();* * Log.d(TAG,"Socket Closed S");* * } catch (Exception e1){* * socket.close();* * Log.d(TAG,"Socket Bind Error");* * e1.printStackTrace();* * }* * * * * * } catch (Exception e1) {* * * * // TODO Auto-generated catch block* * Log.d(TAG,"Socket Creation Error");* * e1.printStackTrace();* * }* * * * * Also from the logcat the exception I see for the same is: *W/System.err(10996): java.net.SocketTimeoutException: Connection timed out* *W/System.err(10996): at org.apache.harmony.luni.platform.OSNetworkSystem.connect(Native Method)* *W/System.err(10996): at dalvik.system.BlockGuard$WrappedNetworkSystem.connect(BlockGuard.java:357)* *W/System.err(10996): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:207) * *W/System.err(10996): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:440) * *W/System.err(10996): at java.net.Socket.connect(Socket.java:1013)* *W/System.err(10996): at java.net.Socket.connect(Socket.java:956)* *W/System.err(10996): at com.example.pdwn.TService.onCreate(TService.java:98)* *W/System.err(10996): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2223)* *W/System.err(10996): at android.app.ActivityThread.access$2500(ActivityThread.java:132)* *W/System.err(10996): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1102)* *W/System.err(10996): at android.os.Handler.dispatchMessage(Handler.java:99)* *W/System.err(10996): at android.os.Looper.loop(Looper.java:150)* *W/System.err(10996): at android.app.ActivityThread.main(ActivityThread.java:4293)* *W/System.err(10996): at java.lang.reflect.Method.invokeNative(Native Method)* *W/System.err(10996): at java.lang.reflect.Method.invoke(Method.java:507)* *W/System.err(10996): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849) * *W/System.err(10996): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)* *W/System.err(10996): at dalvik.system.NativeStart.main(Native Method)* I am not sure why, the connect function is timing out. Specially given that ping operation is successful. Any help will be greatly appreciated. Thanks, Arpit. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

