mongodb - I/flutter (30720) : SocketException: OS Error: Connection timed out, errno = 110,地址 = 192.19.170.13,端口 = 47763

标签 mongodb api http flutter socketexception

我使用的是真实设备(不是安卓模拟器)
后端: MongoDb 图集 ,
API:带-beta ,得到这个错误:
I/flutter (30720): SocketException: OS Error: Connection timed out, errno = 110, address = 192.19.170.13, port = 47763
(发现了很多类似的问题,但没有一个是使用真实设备进行测试的)

    try {
      var ip = '192.19.170.13';
      setState(() => _isSubmitting = true);
      http.Response response =
          await http.post('http://$ip:1337/auth/local/register',
 /* I've also tried using localhost(it didn't work) everyone suggested to use my loopback adapter's (Ethernet's ip address) even that isn't working.*/
 body: {
        'username': _username,
        'email': _email,
        'password': _password,
      });

      final responseData = json.decode(response.body);
      setState(() => _isSubmitting = false);
      _successSnackBar();
      print(responseData);
    } catch (e) {
      setState(() => _isSubmitting = false);
      print(e.toString());
    }
  }

最佳答案

如果您使用的是 Chrome,则需要访问
Chrome ://检查/#devices
并像这样将您的端口添加到“端口转发”
enter image description here
并确保您的设备上有 USB 调试。

关于mongodb - I/flutter (30720) : SocketException: OS Error: Connection timed out, errno = 110,地址 = 192.19.170.13,端口 = 47763,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60155822/

相关文章:

javascript - 如何在 NodeJS 上使用 nanoid 模块?

node.js - Mongoose 仅​​保存 objectId 而不是整个对象

HTTP ETag 和 HTTP 重定向

node.js - 如何获得对 http 请求文件上传中止的响应?

mongodb - 如何按两个不同的字段分组

node.js - Mongoose JS : Subdoc Schemas in Separate Files

javascript - 使用 Laravel 5.4 API 和 Vue.js 进行用户身份验证

api - AutoScaleGroup 中的 AWS EC2 CloudWatch Mem Util 和 Disk Util

php - 无法加载资源 ""。确保有一个加载程序支持 "rest"类型

python - 如何调试 HTTP 502 错误?