Hello, I am using the MQTT-C library (https://github.com/LiamBindle/MQTT-C) in my NuttX project and I am facing a quite interesting issue with a specific server.
For a specific broker, which is a commercial one, after the connection is established, when the MQTT Connect message is sent, the firmware gets stuck. Debugging the code, I can see that the send() function is blocked. When I set the socket, I setup to work in non-blocking mode: === /* * Opening socket */ int sockfd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_IP); if (sockfd == -1) { syslog(LOG_ERR, "MqttClient: error socket() %d (%s)\n",errno,strerror(errno)); return -1; } struct timeval tv; tv.tv_sec = 3; tv.tv_usec = 0; setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (FAR const void *)&tv, sizeof(struct timeval)); setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, (FAR const void *)&tv, sizeof(struct timeval)); /* * Connecting */ int rv = connect(sockfd, server_address, server_address_len); syslog(LOG_DEBUG,"connect() = %d\n",rv); if(rv == -1) { syslog(LOG_ERR, "MqttClient: error connect() %d (%s)\n",errno,strerror(errno)); close(sockfd); sockfd = -1; return -1; } /* * make non-blocking */ if (sockfd != -1) { fcntl(sockfd, F_SETFL, fcntl(sockfd, F_GETFL) | O_NONBLOCK); } === I couldn't find the reason why the send() function gets stuck. And, worst, it happens when I try to communicate with a specific broker. Can anyone give me advice about why it is happening and what I am doing wrong? Best regards, Flavio -- Flavio de Castro Alves Filho flavio.al...@gmail.com Twitter: http://twitter.com/#!/fraviofii LinkedIn profile: www.linkedin.com/in/flaviocastroalves