Reputation: 257
Can 3G Data Session and WIFI Direct concurrently work?? if so, then two IPaddress Exist, will it cause confusion? one example:
A use 3G to download a video file, now the progress is 50%. Now A select a picture, and want to use WIFIDirect to share to B. will this succeed without interrupt the video file downloading?? say the WIFI connection is ok, then A have 2 Ip address, in Picture sharing , which Ip Address will be used?
Upvotes: 1
Views: 3194
Reputation: 1086
You can route using requestRouteToHost API i.e. Video Download can happening as below if you know the host address where the Video is stored:
ConnectivityManager connManager = null;
if(mContext != null) {
connManager = (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] netInfos = connManager.getAllNetworkInfo();
for(int loop_index=0;loop_index<netInfos.length;loop_index++){
switch(netInfos[loop_index].getType())
{
case ConnectivityManager.TYPE_MOBILE_HIPRI:
if(netInfos[loop_index].getState()== NetworkInfo.State.CONNECTED){
connectionSet = connManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_HIPRI, lookupHost("Video Stored Address"));
}
break;
case ConnectivityManager.TYPE_WIFI:
if(netInfos[loop_index].getState()== NetworkInfo.State.CONNECTED)
break;
default:
if(netInfos[loop_index].getState()== NetworkInfo.State.CONNECTED)
break;
}
}
}
private static int lookupHost(String hostname) {
InetAddress inetAddress;
try {
inetAddress = InetAddress.getByName(hostname);
} catch (UnknownHostException e) {
return -1;
}
byte[] addrBytes;
int addr;
addrBytes = inetAddress.getAddress();
addr = ((addrBytes[3] & 0xff) << 24)
| ((addrBytes[2] & 0xff) << 16)
| ((addrBytes[1] & 0xff) << 8)
| (addrBytes[0] & 0xff);
return addr;
}
Upvotes: 0
Reputation: 1
Although the Android phones do not allow concurrent use of two interfaces at the same time, it can be done through application development. I have developed a download accelerator for Windows that uses both WIFI and Ethernet interfaces for TCP connections at the same time.
The two interfaces can be used for TCP connections only, having two different IP addresses. You can develop an application for Android phones that will first determine the size of a file in bytes and send a bytes request on each interface. Remember that UDP connections are impossible in concurrent interfaces.
Upvotes: 0
Reputation: 542
I am running my own WiFi Direct application on my Galaxy Nexus while my 3G is on and I have not experienced any problems so far. This is most certainly because WiFi Direct application is using android.net.wifi.p2p package. When you get your IP over 3G, android.net.wifi package is used. Therefore, there can be two different IP addresses availabe for your device. And for picture sharing, local IP will be used.
Upvotes: 2
Reputation: 68187
I don't think two simultaneous connections are possible because when you turn-on WiFi, it automatically turns off 3g and uses WiFi as default connection. And its vice versa.
At least this is the behavior i've noticed on all of my android phones.
Upvotes: 1
Reputation: 1032
Can 3G Data Session and WIFI Direct concurrently work?? yes... can work
will this succeed without interrupt the video file downloading?? yes..
In Picture sharing , which Ip Address will be used? Local IP i guess. havent checked though
Upvotes: 0