xiaotailang opened a new issue, #10932:
URL: https://github.com/apache/nuttx/issues/10932

   Hello everyone, I have noticed an issue while using socket for multiplexing. 
I wrote a server program based on non-blocking sockets and select. However, 
when I tried to connect to the server using a telnet client, I found that the 
connection was immediately closed. To investigate this matter, I examined the 
provided example `poll_main.c` from the system. I discovered that the example, 
when using select on non-blocking sockets, can successfully send and receive 
data with telnet without experiencing immediate disconnection. Upon careful 
examination of the code in the example, I noticed a difference compared to my 
implementation. In my code, I first called select to listen for the socket file 
descriptor and then used accept to accept the incoming connection request. 
However, in the system's example, they first called accept to handle a 
connection request and then used select to listen. I would like to know if it 
is necessary to follow the example's approach when using select in the s
 ystem. Is it also possible, similar to standard Linux behavior, to use select 
first and then accept? In my implementation where select is called before 
accept, the telnet client returns 'connection closed by foreign host' when the 
connection is terminated.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to