【问题标题】:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: SocketException: OS Error: Connection refused, errno =111,address =server ip, port = 33450flutter/lib/ui/ui_dart_state.cc(186)] 未处理异常:SocketException:操作系统错误:连接被拒绝,errno = 111,地址 = 服务器 ip,端口 = 33450
【发布时间】:2022-02-26 14:22:35
【问题描述】:

我有一个带有颤振的应用程序。我必须连接到服务器我的 ip 就像 =https://91.#.#.#:5000/api 当我将数据发布到服务器时,我得到 flutter/lib/ui/ui_dart_state.cc(186)] 未处理的异常:SocketException:操作系统错误:连接被拒绝,errno = 111,地址 = 服务器 ip,端口 = 33450 我的代码 var url = Uri.parse(AddressController.text); http.Response 响应 = 等待 http.post(url, body: {});

【问题讨论】:

    标签: flutter post port


    【解决方案1】:

    SocketException 通常发生在您没有互联网时请让用户知道您有互联网,如果您在真实设备上进行测试,请确保您在清单中添加互联网权限

    【讨论】:

    • internet 权限在 mainfest 中,我有 flutter/lib/ui/ui_dart_state.cc(186)] 未处理的异常:SocketException: OS Error: Connection denied, errno =111,address =server ip, port = 33450 我的代码 var url = Uri.parse(AddressController.text); http.Response 响应 = 等待 http.post(url, body: {});
    • 你能用URL代替IP地址吗
    • 没有。我应该使用IP地址
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-26
    • 2020-06-07
    • 2019-12-01
    • 2022-06-18
    • 2022-10-05
    • 2020-05-11
    • 2020-09-03
    相关资源
    最近更新 更多