Good that you send the whole output from client and server so i could make sure every byte was send ;)
I've spotted another thing while true: let client = await server.accept() echo "New client connected" asyncCheck processClient(client, fileName) Run the while loop is fishy you can't get out of that... with the way you have set it up you kind of accepting multiple clients at the same time. Again asyncCheck does not wait and the while loop continues... so you want most likely use waitFor again and remove the while... echo "waiting for client..." let client = await server.accept() echo "New client connected" waitFor processClient(client, fileName) echo "client done" Run You can try the additional echos with the while and the asyncCheck. to see what happens... I didn't try it so don't take this for granted... Saying that you mix up async with with blocking calls... that is not advisable You should never call blocking functions inside an async block... So for writing the file you want to use <https://nim-lang.org/docs/asyncfile.html> And for the stdin.readLine you have to dig... For a starting point <https://forum.nim-lang.org/t/5227>