ADB tcpip 在 IPv6 上工作

Posted

技术标签:

【中文标题】ADB tcpip 在 IPv6 上工作【英文标题】:ADB tcpip works over IPv6 【发布时间】:2021-06-07 05:32:18 【问题描述】:

我正在尝试通过 tcpip 连接到我的设备,但命令 adb tcpip 5555 通过 IPv6 启动所有接口中的侦听端口。

PS C:\Users\David> adb -s 5200bade8d87c567 tcpip 5555
restarting in TCP mode port: 5555

PS C:\Users\David> adb -s 5200bade8d87c567 shell netstat -ant
Active Internet connections (established and servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 192.168.1.97:37536      13.107.42.14:443        ESTABLISHED
tcp      130      0 192.168.1.97:36988      216.58.211.234:443      CLOSE_WAIT
tcp        0      0 192.168.1.97:36984      31.13.83.36:443         ESTABLISHED
tcp        0      0 192.168.1.97:38210      31.13.83.4:443          ESTABLISHED
tcp      130      0 192.168.1.97:42996      216.58.215.138:443      CLOSE_WAIT
tcp        0      0 192.168.1.97:59850      172.217.17.4:443        CLOSE_WAIT
tcp        0      0 192.168.1.97:60716      31.13.83.8:443          ESTABLISHED
tcp        0      0 192.168.1.97:60712      31.13.83.8:443          ESTABLISHED
tcp        0      0 192.168.1.97:37154      216.58.211.234:443      TIME_WAIT
tcp        0      0 192.168.1.97:36980      31.13.83.36:443         ESTABLISHED
### Here is the adbd
tcp6       0      0 :::5555                 :::*                    LISTEN
###
tcp6      32      0 ::ffff:192.168.1.:47634 ::ffff:44.236.220.4:443 CLOSE_WAIT
tcp6       0      0 ::ffff:192.168.1.:60088 ::ffff:172.217.168.:443 ESTABLISHED
tcp6       0      0 ::ffff:192.168.1.:55526 ::ffff:216.58.211.2:443 ESTABLISHED
tcp6       0      0 ::ffff:192.168.1.:56700 ::ffff:172.217.168.:443 ESTABLISHED
tcp6       0      0 ::ffff:192.168.1.:57900 ::ffff:142.250.184.:443 TIME_WAIT
tcp6       0      0 ::ffff:192.168.1.:46458 ::ffff:172.217.168.:443 ESTABLISHED
tcp6       0      0 ::ffff:192.168.1.:49284 ::ffff:142.250.185.:443 ESTABLISHED
tcp6       0      0 ::ffff:192.168.1.:57066 ::ffff:216.58.205.2:443 ESTABLISHED
tcp6       0      0 ::ffff:192.168.1.:53960 ::ffff:172.217.21.1:443 ESTABLISHED
tcp6       0      0 ::ffff:192.168.1.:57052 ::ffff:172.217.18.4:443 ESTABLISHED
tcp6       0      0 ::ffff:192.168.1.:37164 ::ffff:216.58.211.2:443 ESTABLISHED
tcp6       0      0 ::ffff:192.168.1.:50014 ::ffff:74.125.133.:5228 ESTABLISHED
tcp6       0      0 ::ffff:192.168.1.:42466 ::ffff:172.217.17.3:443 ESTABLISHED

PS C:\Users\David> adb -s 5200bade8d87c567 shell ip -f inet addr show wlan0
11: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet 192.168.1.97/24 brd 192.168.1.255 scope global wlan0
       valid_lft forever preferred_lft forever

PS C:\Users\David> adb connect 192.168.1.97:5555
cannot connect to 192.168.1.97:5555: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060)

我也在尝试使用 IPv6 地址进行连接,但也不起作用。

PS C:\Users\David> adb -s 5200bade8d87c567 shell ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
11: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 fe80::d27f:a0ff:fecc:fd5f/64 scope link
       valid_lft forever preferred_lft forever

PS C:\Users\David> adb connect [fe80::d27f:a0ff:fecc:fd5f]:5555
cannot connect to fe80::d27f:a0ff:fecc:fd5f:5555: An attempt was made to access a socket in a way forbidden by its access permissions. (10013)

有没有通过 IPv4 启动服务器的选项?

谢谢。

【问题讨论】:

【参考方案1】:

我发现了问题。我已连接到 *** (Cisco AnyConnect)。

【讨论】:

以上是关于ADB tcpip 在 IPv6 上工作的主要内容,如果未能解决你的问题,请参考以下文章

ADB tcpip 命令在没有电缆的 Windows 中不起作用

已启用NetBIOS over Tcpip 下栏临时IPv6 地址啥意思

不带电缆的 ADB tcpip 命令

Appium ADB 错误:当设备通过端口 5555 上的 tcpip 连接时,获取设备平台版本时出错

adb通过wifi连接android设备

ADB工作原理