How can I connect two Android device by socket without server

后端 未结 4 955
半阙折子戏
半阙折子戏 2021-02-08 12:14

I am trying to develop an android application that can exchange data on peer to peer connection with other devices without server. So please suggest how can I do this. Thank you

4条回答
  •  佛祖请我去吃肉
    2021-02-08 12:57

    Java provides ServerSocket and Socket to communicate b/w devices. One of the device you can make as server and other device you can make as client and communicate b/w 'em without introducing server hosted on some machine.

    The Other and better option is Using Wi-Fi Peer-to-Peer. WifiP2pManager help you to achieve your purpose.Here is an example.

提交回复
热议问题