This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 7a5f4820f472fdc16acc680fb84cf963bca6c32e
Author: Marco Casaroli <[email protected]>
AuthorDate: Mon Nov 2 11:19:22 2026 +0100

    examples/netloop: Do not die of SIGPIPE when a client closes.
    
    lo_listener echoes the data back with send().  When the client closed
    the connection, the send fails with EPIPE.  A send to a stream socket
    whose peer is gone also raises SIGPIPE, and with
    CONFIG_SIG_SIGPIPE_ACTION the default action ends the example.
    
    Send with MSG_NOSIGNAL.  The send error closes only this connection, as
    before.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 examples/netloop/lo_listener.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/netloop/lo_listener.c b/examples/netloop/lo_listener.c
index a1ad46b05..d435f2f79 100644
--- a/examples/netloop/lo_listener.c
+++ b/examples/netloop/lo_listener.c
@@ -144,7 +144,7 @@ static inline bool net_incomingdata(struct net_listener_s 
*nls, int sd)
 
           for (nbytes = ret, ptr = nls->buffer; nbytes > 0; )
             {
-              ret = send(sd, ptr, nbytes, 0);
+              ret = send(sd, ptr, nbytes, MSG_NOSIGNAL);
               if (ret < 0)
                 {
                   if (errno != EINTR)

Reply via email to