View all comments
On Unix receiving to a buffer shorter than the incoming payload silently truncates the read. On Windows the read is completed but an error is returned. Not being that familiar with Windows I found this behaviour surprising.
The following comment in sys/windows/net.rs suggests that making Unix and Windows behave the same is (at times) a goal of the standard library:
// On unix when a socket is shut down all further reads return 0, so we
// do the same on windows to map a shut down socket to returning EOF.
If it is I'd like to propose that WSAEMSGSIZE be absorbed so that both platforms behave the same.
View all comments
On Unix receiving to a buffer shorter than the incoming payload silently truncates the read. On Windows the read is completed but an error is returned. Not being that familiar with Windows I found this behaviour surprising.
The following comment in
sys/windows/net.rssuggests that making Unix and Windows behave the same is (at times) a goal of the standard library:If it is I'd like to propose that
WSAEMSGSIZEbe absorbed so that both platforms behave the same.