protohackers/0.ts

15 lines
296 B
TypeScript
Raw Normal View History

2022-10-11 13:10:03 -05:00
import { copy } from "https://deno.land/std@0.156.0/streams/conversion.ts";
const PORT = 5588;
console.log(`Listening on port ${PORT}`);
for await (const conn of Deno.listen({ port: PORT })) {
2022-10-11 13:39:54 -05:00
echo(conn);
}
async function echo(conn: Deno.Conn) {
2022-10-11 13:10:03 -05:00
await copy(conn, conn);
conn.close();
}