Skip to content

Network.Socket.recv throws IOException on reading 0 bytes

My man pages has the following to say about the return value of recv:

These calls return the number of bytes received, or -1 if an error occurred.

For TCP sockets, the return value 0 means the peer has closed its half side of the connection.

This means that it's absolutely fine to read 0 bytes when using e.g. UDP socket.

However, the Network.Socket.recv function always throws an exception upon reading 0 bytes regardless of the protocol family.

Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/network
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information