1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 08:33:43 -05:00

fix: Update echo_server to new listen API (denoland/deno_std#625)

Original: 287fbb5dec
This commit is contained in:
Bartek Iwańczuk 2019-10-08 00:05:25 +02:00 committed by Ryan Dahl
parent 96fe2d10a4
commit 910afdb668

View file

@ -1,12 +1,9 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const { listen, copy } = Deno; const hostname = "0.0.0.0";
const port = 8080;
(async (): Promise<void> => { const listener = Deno.listen({ hostname, port });
const addr = "0.0.0.0:8080"; console.log(`Listening on ${hostname}:${port}`);
const listener = listen("tcp", addr); while (true) {
console.log("listening on", addr); const conn = await listener.accept();
while (true) { Deno.copy(conn, conn);
const conn = await listener.accept(); }
copy(conn, conn);
}
})();