Is it possible to transfer data directly between two android devices to other users in the same network?

后端 未结 1 1352
半阙折子戏
半阙折子戏 2021-01-29 01:04

Let\'s say I have two android mobile devices, connected to the same wireless network, and that network hasnt external/internet access.

Without third party software, is i

相关标签:
1条回答
  • 2021-01-29 01:16

    If you want to send data or messages from one phone to another using the network you will eventually need the IP address of the recipient phone. However, If you don't care about targeting specific phones you could always send UDP broadcast packets that each device on the network should receive.

    If you don't want to manually specify an IP you'll need to create a discovery protocol that a phone uses to discover all the other phones on the network. You could do this buy scanning all available IP addresses and checking to see if they are a valid android phone. Or you could have each phone broadcast its presence on the network using a UDP broadcast packet sent to a predefined port.

    Once you have discovered all the phones on the network its really up to you to decide how you want to send the data between phones and there are hundreds of examples of how to send data between devices/computers/processes using sockets.

    0 讨论(0)
提交回复
热议问题