我有一个Websocket服务器,该服务器正在侦听本地计算机上的端口51234。我在android模拟器中运行的Flutter应用正在尝试像这样连接它:
final channel = IOWebSocketChannel.connect('ws://10.0.2.2:51234');
但是会产生以下错误:
E/flutter ( 6480): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: WebSocketChannelException: WebSocketChannelException: SocketException: OS Error: Connection refused, errno = 111, address = 10.0.2.2, port = 37037
所以由于某种原因,Flutter或Android仿真器已将端口51234的请求映射到了37037。如何防止此端口映射?