Search code examples
androidnetwork-programmingandroid-sensorsdata-stream

Stream data from Android device to desktop computer when they are connected to different networks (Android WiFi, computer Ethernet)?


I am trying to make an android application that will stream live sensor data (e.g. accelerometer, etc) from my android device to my desktop computer.

My android device is connected to a WiFi network and my desktop computer is connected to a network with an Ethernet cable.

There are android applications available that send data from an android device to a PC via WiFi, but both devices must be connected to the same network.

Is there a way to transfer data if the two devices are connected to different networks?

Thank you!


Solution

  • Due to the fact that nearly every network sits behind a firewall (in most cases your home router/nat-device) you need to implement port-forwarding to access network 2 from network 1.

    Another aproach would be to set up a VPN (f.i. with SSH) between the 2 hosts.

    If your PC is directly connected to the internet, and has a public ip (that means, if you have NOT a RFC 1918 Adress), then you are able to directly connect to that ip by just entering that ip. If not, you need to implement something to get behind the firewall.