0

Is there a way to use socket connection between raspberry pi 3 and android app using cellular network,NOT a localor wifi network ?

1 Answers1

0

Theoretically, yes absolutely - so long as each device has an IP network connection you can open a socket between them.

In practice, however, you may find you have two issues:

  • getting 'external' IP addresses
  • ensuring that your stream is allowed on your target networks

By external IP addresses, I mean ones that are globally recognised and not just on a local or private network. Most local networks and operator mobile networks use private addressing internally and some sort of NAT (Network Address Translation) function to map these internal addresses to external addresses.

Unless you have a fixed IP address, which is not the norm, you will have to discover what IP address your deice appears on externally and then share that with the other device to allow the socket to be set up. This may change every time you connect to the network, or even more frequently, depending own how the network is set up. Techniques and protocols do exist to do this, such as STUN: https://en.wikipedia.org/wiki/STUN

Assuming you can get the end point addresses in a form that allows them communicate with each other, you will also need to check that your operator, and any local network policies or firewalls you have, allow the type of traffic you want to use. Cellular network operators sometimes block certain traffic types, either for security or to try to stop services which they see as competing with their own services.

Mick
  • 24,231
  • 1
  • 54
  • 120