mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 07:44:48 -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.
|
||||
const { listen, copy } = Deno;
|
||||
|
||||
(async (): Promise<void> => {
|
||||
const addr = "0.0.0.0:8080";
|
||||
const listener = listen("tcp", addr);
|
||||
console.log("listening on", addr);
|
||||
while (true) {
|
||||
const conn = await listener.accept();
|
||||
copy(conn, conn);
|
||||
}
|
||||
})();
|
||||
const hostname = "0.0.0.0";
|
||||
const port = 8080;
|
||||
const listener = Deno.listen({ hostname, port });
|
||||
console.log(`Listening on ${hostname}:${port}`);
|
||||
while (true) {
|
||||
const conn = await listener.accept();
|
||||
Deno.copy(conn, conn);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue