summaryrefslogtreecommitdiff
path: root/examples/echo_server.ts
blob: 95b9f7413174b1fef72f07cc878e96a2c0c32deb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const { listen, copy } = Deno;

(async () => {
  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);
  }
})();