Open strange-v opened 4 years ago
After further investigation, I've found one more issue in this piece of code. Even if "wait_readable" returns NSAPI_ERROR_WOULD_BLOCK, "WIZnetInterface::socket_recv" returns zero, because recved_size is always zero in this case.
Either recved_size should be declared like this
int recved_size = -1;
or condition should be
if(recved_size > 0){
According to the Mbed documentation socket.recv method should return NSAPI_ERROR_WOULD_BLOCK in case it non-blocking or timeout.
But if we check the code we can see that it returns size in case of timeout (zero in many cases).
It seems incorrect. Am I wrong?