mirror of
https://github.com/denoland/deno.git
synced 2024-12-27 09:39:08 -05:00
9dfebbc949
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();
|
|
}
|
|
);
|