我启动了简单的 kafka 服务器。请参阅快速入门部分
我无法连接到上述服务器。这是我的代码:
Deno.listen({ port: 9092, transport: 'tcp' });
// or
Deno.listen({ port: 9092, hostname: 'localhost', transport: 'tcp' });
//or
Deno.listen({ port: 9092, hostname: '127.0.0.1' });
这是错误:
error: Uncaught PermissionDenied: An attempt was made to access a socket in a way forbidden by its access permissions. (os error 10013)
at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
at Object.sendSync ($deno$/ops/dispatch_json.ts:72:10)
at Object.listen ($deno$/ops/net.ts:51:10)
at Object.listen ($deno$/net.ts:152:22)
at Object.listen ($deno$/net_unstable.ts:36:12)
at file:///D:/rust/deno/index.ts:10:6
我试过的命令
deno run --allow-net --allow-write ./index.ts
deno run --allow-net --unstable ./index.ts
deno run --allow-net ./index.ts
我可以在 Rust 帮助下毫无问题地连接到上面的服务器。这是我的锈代码:
fn connect() -> Result<(), std::io::Error> {
let stream = TcpStream::connect("localhost:9092").expect("Could not connect");
}
我是 Deno 的新手。我做错了什么?