Socket Poll functionality in case of socket is closed


Ravi kumar Veeramally
 

Hi,

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

As per https://github.com/zephyrproject-rtos/zephyr/blob/master/subsys/net/lib/sockets/sockets.c#L1018, zsock_poll_prepare_ctx() call returns -EALREADY. 

But https://github.com/zephyrproject-rtos/zephyr/blob/master/subsys/net/lib/sockets/sockets.c#L1088. 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?

Regards,

Ravi.

Join devel@lists.zephyrproject.org to automatically receive all group messages.