wx.stopWifi({
success(res) {
console.log(res.errMsg)
wx.startWifi({
success() {
wx.connectWifi({
SSID:'ZHD_34e7',
password:'12345678',
success(res) {
var data = {
"msgType": "EVENT_WIFI_RESP",
"data": [{
"k": "APssid",
"v": "ZHD_34e7"
}, {
"k": "APpwd",
"v": "12345678"
}, {
"k": "pwd",
"v": "1234567890"
}, {
"k": "ssid",
"v": "Xiaomi_F119"
}, {
"k": "mqttServer",
"v": "link.zihome.com"
}, {
"k": "mqttPort",
"v": "6885"
}]
}
const udp = wx.createUDPSocket();
console.log(udp)
udp.bind()
udp.send({
address: '192.168.199.141',
port: 7777,
message: JSON.stringify(data)
})
udp.onListening(function (res) {
console.log('监听中...')
console.log(res)
})
udp.onMessage(function (res) {
console.log(res)
})
当连接一个局域网之后怎么正常使用createUDPSocket
请问真机调试的时候你的wx.createUDPSocket()这段代码可以实现吗,我的实现不了