如何解决无法修复 Visiual Studio 上的服务器套接字 Flutter Dart
我该如何解决这个错误?我已经加载了 localhost 但仍然出现相同的错误。这是我的代码:
Future<void> connect() async {
var server = await HttpServer.bind(InternetAddress.loopbackIPv4,80);
server.listen((request) async {
// Check if the path is '/login'
if (request.uri.path == '/login') {
// Create OpenId instance with the current request.
OpenId openId = OpenId(request);
// Switch the mode
switch (openId.mode) {
// No mode is set
case '':
{
//Redirect the user to the authUrl.
request.response
..redirect(openId.authUrl())
..close();
break;
}
// Authentication failed/cancelled.
错误:
E/flutter (16515): [ERROR:flutter/lib/ui/ui_dart state.cc(184)] Unhandled Exception: SocketException: Failed to create server socket (OS Error: Permission denied,errno = 13),address = 127.0.0.1,port = 80
解决方法
端口 80 等较低的端口号通常仅限于以管理员身份运行的程序使用。因此,您的错误告诉您端口 80 受权限限制。
您可以使用更高的端口号,例如 8080,而不是以管理员身份运行应用程序。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。