This commit is contained in:
Daniel Flanagan 2022-11-19 20:43:14 -06:00
parent 8083295c42
commit c2b37f5645
Signed by untrusted user: lytedev-divvy
GPG key ID: 6D69CEEE4ABBCD82

4
6.ts
View file

@ -21,7 +21,9 @@ function chatSession(conn: Deno.Conn) {
async function serve(conn: Deno.Conn) { async function serve(conn: Deno.Conn) {
const reader = new BufReader(conn); const reader = new BufReader(conn);
reader.peek(1); const type = await reader.peek(1);
if (!type) throw new Error("failed to peek start of packet");
console.log(type);
} }
for await (const conn of Deno.listen({ port: PORT })) { for await (const conn of Deno.listen({ port: PORT })) {