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:
parent
96fe2d10a4
commit
910afdb668
1 changed files with 8 additions and 11 deletions
|
@ -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);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
Loading…
Reference in a new issue