1
가 발생합니다. 예외는 다음과 같습니다.다트의 HTTP 서버는이 간단한 다트 프로그램을 시작하고 잠시 동안 실행하지만, 일부 상호 작용 이후에 예외를 throw하는 예외
Unhandled exception:
SocketException: OS Error: Broken pipe, errno = 32, address = ::, port = 443
#0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:1108)
#1 _microtaskLoop (dart:async/schedule_microtask.dart:41)
#2 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:99)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:152)
버그입니까?
어떻게 문제를 해결할 수 있습니까?
다른 주제 ... 적절한 암호를 제공하지 않고 https 서버를 시작할 수있는 이유는 무엇입니까? 서버가 암호가 맞는지 확인하길 기대하니?! ...
가 나는 예외import 'dart:io';
import 'package:http_server/http_server.dart';
main() async {
//files
var staticFiles = new VirtualDirectory("file");
staticFiles.allowDirectoryListing = true;
staticFiles.directoryHandler = (dir, request) {
try{
var indexUri = new Uri.file(dir.path).resolve('index.html');
staticFiles.serveFile(new File(indexUri.toFilePath()), request);
} catch(a,b) {
print(a);
print(b);
}
};
//http
HttpServer
.bind(InternetAddress.ANY_IP_V6, 80)
.then((server) {
try{
server.forEach(staticFiles.serveRequest);
} catch(a,b)
{
print(a);
print(b);
}
}
);
//https
SecurityContext context = new SecurityContext();
var chain = Platform.script.resolve('file.pem').toFilePath();
var key = Platform.script.resolve('file.pem').toFilePath();
context.useCertificateChain(chain);
context.usePrivateKey(key, password: 'pwd');
HttpServer
.bindSecure(InternetAddress.ANY_IP_V6, 443, context)
.then((server) {
try {
server.forEach(staticFiles.serveRequest);
} catch(a, b){
print(a);
print(b);
}
}
);
을 잡기 해결하려하지만 도움이되지 않았다
내 프로그램으로 인해 예외가 발생하는 이유는 무엇입니까? – Michael