Moto G的dosent收到了WIFI网络的UDP数据包 [英] Moto G dosent receive UDP packets over WIFI Network

查看:188
本文介绍了Moto G的dosent收到了WIFI网络的UDP数据包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的接收器没有收到Moto G的任何UDP数据包,但它适用于其他设备很好。

My receiver don't receive any UDP packet in Moto G but it works for other devices well.

在WiFi网络我已经从其他设备成功地发送UDP数据包。但在摩托E和Moto G的它不工作。

Over WiFi network I have send UDP packets successfully from other devices. But in Moto E and Moto G it is not working.

谁能帮助弄清楚为什么它不工作的摩托G / E?

Can anyone help figure out why it's not working for Moto G/E?

我的问题是,我是不会接受通过WiFi网络的UDP数据包。

My problem was that i was not Receiving any UDP Packets over WiFi Network.

推荐答案

试试这个code。这对我的工作。

Try this code. It's work for me.

 public void run() {
        Looper.prepare();
        try {
          WifiManager.MulticastLock lock;
          WifiManager wifi;

          wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
          if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
          if (lock == null)
          lock = wifi.createMulticastLock("WiFi_Lock");
          lock.setReferenceCounted(true);
          lock.acquire();
         }
      }
      catch(Exception e)
      {
        Log.d("Wifi Exception",""+e.getMessage().toString());
      }
    }

这篇关于Moto G的dosent收到了WIFI网络的UDP数据包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆