I'm sorry ... I got the same behavior, but the send function now started to work non-blocking.
Here is my situation: * I have 2 mqtt brokers (tcp servers) - one commercial (Tago.io) - one personal (Mosquitto) After a successful connection in both cases, the next step is to send the mqtt connect message. Below shows the execution trace for the commercial broker. [972934023.720000] [ INFO] psock_vfcntl: sockfd=0x10007a70 cmd=9 [972934023.730000] [ INFO] psock_tcp_send (0x1000a9ac): [972934023.730000] [ INFO] 0000 10 42 00 04 4d 51 54 54 04 c2 01 90 00 07 54 65 .B..MQTT......Te [972934023.740000] [ INFO] 0010 73 74 65 47 57 00 07 70 68 69 74 61 67 6f 00 24 steGW..phitago.$ [972934023.750000] [ INFO] 0020 30 66 30 62 36 37 33 64 2d 33 64 35 66 2d 34 38 0f0b673d-3d5f-48 [972934023.760000] [ INFO] 0030 38 62 2d 62 38 62 36 2d 62 36 35 36 35 66 37 39 8b-b8b6-b6565f79 [972934023.770000] [ INFO] 0040 66 32 66 64 f2fd [972934023.780000] [ INFO] tcp_max_wrb_size: tcp_max_wrb_size = 0 for conn 0x20006e78 [972934023.780000] [ INFO] psock_tcp_send: new wrb 0x200073fc (non blocking) [972934023.790000] [ INFO] iob_copyin_internal: iob=0x20004238 len=0 offset=0 The send() result is 0. And keeps always in this way. And below we have the traces for the personal broker transmission. [972932455.670000] [ INFO] psock_vfcntl: sockfd=0x10007a70 cmd=9 [972932455.670000] [ INFO] psock_tcp_send (0x1000a9ac): [972932455.680000] [ INFO] 0000 10 42 00 04 4d 51 54 54 04 c2 01 90 00 07 54 65 .B..MQTT......Te [972932455.690000] [ INFO] 0010 73 74 65 47 57 00 07 70 68 69 74 61 67 6f 00 24 steGW..phitago.$ [972932455.700000] [ INFO] 0020 30 66 30 62 36 37 33 64 2d 33 64 35 66 2d 34 38 0f0b673d-3d5f-48 [972932455.710000] [ INFO] 0030 38 62 2d 62 38 62 36 2d 62 36 35 36 35 66 37 39 8b-b8b6-b6565f79 [972932455.710000] [ INFO] 0040 66 32 66 64 f2fd [972932455.720000] [ INFO] tcp_max_wrb_size: tcp_max_wrb_size = 2144 for conn 0x20006e78 [972932455.730000] [ INFO] psock_tcp_send: new wrb 0x200073fc (non blocking) [972932455.740000] [ INFO] iob_copyin_internal: iob=0x20004238 len=68 offset=0 [972932455.750000] [ INFO] iob_copyin_internal: iob=0x20004238 avail=0 len=68 next=0 In this case, send return a value bigger than 0. Could you please give me any advice to understand what's going on? Or what can I check? The connect() response is 0 in both cases. Using PC-based tools, such as MQTT.Fx, I can connect to the host. Best regards, Flavio Em sáb., 26 de jun. de 2021 às 13:57, Gregory Nutt <spudan...@gmail.com> escreveu: > > > > Is there any chance that the broker didn't like the mqtt connect > > message and shutdown the connection and leaving my device alone ... > > all during send call? > If the peer disconnects, the socket should be marked disconnected and > the send() should fail with an error. -- Flavio de Castro Alves Filho flavio.al...@gmail.com Twitter: http://twitter.com/#!/fraviofii LinkedIn profile: www.linkedin.com/in/flaviocastroalves