Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在两个 android 模拟器之间进行通信以进行通信,因此我试图将端口 X 转发到 127.0.0.1 上的端口 Y,其中端口 X 也是我正在传输的端口,而 Y 是我正在接收的端口。这可能吗?如果可以,我该如何转发本地端口?
socat 工具对此很有用:
socat TCP-LISTEN:Y TCP:localhost:X
(假设你在 Linux 中)
谷歌搜索显示portfwd。虽然它很古老,但它似乎在做你描述的事情。其他结果表明 iptables 也可以做你想做的事,但我找不到简洁的指南。
我想通过AVD 控制台或adb命令来使用模拟器端口重定向会更容易。
adb