1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00
denoland-deno/tests/echo_server.ts

10 lines
263 B
TypeScript
Raw Normal View History

2018-10-11 16:55:22 -04:00
import { args, listen, copy } from "deno";
const addr = args[1] || "127.0.0.1:4544";
const listener = listen("tcp", addr);
console.log("listening on", addr);
listener.accept().then(async conn => {
await copy(conn, conn);
conn.close();
listener.close();
});