How many bytes are available is not a fixed number when dealing with byte streams, it can change at any time.
You can use the version of [recv with a timeout](https://nim-lang.org/docs/net.html#recv%2CSocket%2Cstring%2Cint%2Cint) and a suitably large number Or mess about with ioctl and FIONREAD but it's almost never worth it