Socket Poll functionality in case of socket is closed

Ravi kumar Veeramally


what should be the return value or behavior of socket poll() call in case of TCP socket is closed from peer side.

As per, zsock_poll_prepare_ctx() call returns -EALREADY. 

But Return value of z_fdtable_call_ioctl() function call handler assumes " If POLL_PREPARE returned with EALREADY, it means it already detected that some socket is ready."

I did a simple test with few modifications in echo-client and echo-server in net tools. echo-server closes the client connection. poll(fds, nfds, 0) call returns "> 0" and error value set to 0. But send failed with return value -ve and error value set to ESHUTDOWN.

Any thoughts @rlubos @pfalcon?



Join to automatically receive all group messages.