diff options
-rw-r--r-- | bench/snippets/tcp-echo.bun.ts | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/bench/snippets/tcp-echo.bun.ts b/bench/snippets/tcp-echo.bun.ts index b2a8c26e6..c0f227e75 100644 --- a/bench/snippets/tcp-echo.bun.ts +++ b/bench/snippets/tcp-echo.bun.ts @@ -34,16 +34,18 @@ setInterval(() => { counter = 0; }, 1000); -const server = listen({ - socket: handlers, - hostname: "0.0.0.0", - port: 8080, - data: { - isServer: true, - }, -}); -const connection = await connect({ - socket: handlers, - hostname: "0.0.0.0", - port: 8080, -}); +if (process.env.IS_SERVER) + listen({ + socket: handlers, + hostname: "0.0.0.0", + port: 8000, + data: { + isServer: true, + }, + }); +else + await connect({ + socket: handlers, + hostname: "localhost", + port: 8000, + }); |