【问题标题】:How to set port number of android device using wifimanager?如何使用wifimanager设置android设备的端口号?
【发布时间】:2013-04-17 07:57:35
【问题描述】:

我正在尝试使用 wifimanager 将其他设备与我的 android 应用程序连接。我正在使用此代码获取我的 android 设备的 ip 地址。但我无法获取使用 wifi 的我的 android 设备的端口号。如何获取它???请帮我!!!!提前谢谢...

 wifiManager = (WifiManager)context.getSystemService(context.WIFI_SERVICE); 
     wifiInfo = wifiManager.getConnectionInfo();
         int ipAddress = wifiInfo.getIpAddress();
         ip_Address=String.format("%d.%d.%d.%d",(ipAddress & 0xff),(ipAddress >> 8 &     `0xff),(ipAddress >> 16 & 0xff),(ipAddress >> 24 & 0xff));

`

【问题讨论】:

    标签: java android android-wifi wifimanager wifi


    【解决方案1】:

    当您谈论 Wifi 连接到的端口时,您实际上想要获取 Wifi 连接到的代理主机的代理端口。要获得此类设置,请使用以下库:

    https://code.google.com/p/android-proxy-library/

    还请看下面:

    http://developer.android.com/reference/android/net/Proxy.html

    没有与 Wifi 或 WLAN 相关的实际端口。为什么要获取端口?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-30
      • 1970-01-01
      • 1970-01-01
      • 2015-08-28
      • 2015-03-15
      • 2023-03-15
      相关资源
      最近更新 更多