mirror of
https://github.com/denoland/deno.git
synced 2025-02-24 06:02:18 -05:00

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: LE GOFF Vincent <g_n_s@hotmail.fr>
11 lines
286 B
TypeScript
11 lines
286 B
TypeScript
const { args, listen, copy } = 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): Promise<void> => {
|
|
await copy(conn, conn);
|
|
conn.close();
|
|
listener.close();
|
|
}
|
|
);
|