mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
12 lines
394 B
TypeScript
12 lines
394 B
TypeScript
import { copy } from "../../tests/util/std/io/copy.ts";
|
|
const addr = Deno.args[0] || "0.0.0.0:4544";
|
|
const [hostname, port] = addr.split(":");
|
|
const listener = Deno.listen({ hostname, port: Number(port) });
|
|
console.log("listening on", addr);
|
|
listener.accept().then(
|
|
async (conn) => {
|
|
console.log("received bytes:", await copy(conn, conn));
|
|
conn.close();
|
|
listener.close();
|
|
},
|
|
);
|