收藏
回答

为什么UDP 通信 iOS系统 onError监听返回errCode:-1?

this.udp = wx.createUDPSocket()
this.udp.bind(UDP_PORT)
let _this = this
this.udpSend({
  "e": "req_mac"
})
this.udp.onMessage(res => {
  let udpRes = JSON.parse(_this.newAb2Str(res.message))
  if (udpRes.e == 'resp_mac') {
    _this.mac = udpRes.m
    _this.manaul()
  } else if (udpRes.e == 'resp_netset_ok') {
    _this.udp.close()
    _this.weToast.hide()
    wx.showToast({
      icon: 'none',
      title: '保存成功'
    })
    wxNav.navigateBack()
  }
})

this.udp.onError(e => {
  _this.weToast.hide()
  util.showError(e)
})

最后一次编辑于  2020-07-27
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签