How to start a local network connection programmatically via Wi-Fi hotspot on Android?

前端 未结 5 1987
别跟我提以往
别跟我提以往 2020-12-30 06:32

I want to start a local network connection using the built-in Wi-Fi hotspot on Android devices. Is there a way to accomplish it? And how to communicate between two devices?<

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-30 07:15

    i dont know programmically create wify LAN,but you can create wify LAN manually,then you can do java tcp/udp program as said by brianestey

    "As for your second question, how to communicate - you need to establish a connection between the devices. For this, you need the ip address of the server. The simplest thing to do would be to show the ip address on the server UI and then manually enter it on the clients and press connect. It would then establish a connection to the server on a known port and you can send messages between client and server."

    for manual connection follow the steps

    • take settings/wireless&networks/portable wi-fi hotspot settings from any one of the phone

    • create new hotspot and turn on wi-fi portable hotspot from there

    • connect all other device to that hotspot including your pc

    • you will get ip of each device programmically (includig pc,but i dont know)

提交回复
热议问题