0

I am trying to connect to my mosquitto broker on esp32 with GSM using pubsubclient but sometimes it disconnect to broker with detail malformed packet.

2023-08-30T13:43:14: Client client_id disconnected due to malformed packet.

i have dump at command on device and it display like this :

13:31:08.540 > DATA ACCEPT:0,2
13:31:08.540 > AT+CIPSEND=0,2
13:31:08.568 > 
13:31:08.568 > 
13:31:08.570 >  
13:31:08.604 > DATA ACCEPT:0,2
13:31:08.604 > AT+CIPRXGET=4,0
13:31:08.660 > 
13:31:08.660 > +CIPRXGET: 4,0,0
13:31:08.660 > 
13:31:08.660 > OK
13:31:08.660 > AT+CIPSTATUS=0
13:31:08.755 > 
13:31:08.755 > +CIPSTATUS: 0,0,"TCP","13.228.184.92","80","CONNECTED"
13:31:08.760 > 
13:31:08.760 > OK
13:31:09.762 > AT+CIPRXGET=4,0
13:31:09.780 > 
13:31:09.781 > +CIPRXGET: 1,0
13:31:09.817 > 
13:31:09.818 > +CIPRXGET: 4,0,370
13:31:09.818 > 
13:31:09.818 > OK
13:31:09.818 > AT+CIPSTATUS=0
13:31:09.917 > 
13:31:09.918 > +CIPSTATUS: 0,0,"TCP","BROKER IP","80","REMOTE CLOSING"

i have limit some possibility that causing the problem

  • After fail to connect to broker i try to connect to server using http and it connected without problem
  • try using public broker like hivemq for a short time and it not have a problem
  • I have try to connect to broker using another device (android, mqttx, etc) and run well also.
9
  • 1
    Why do you think connecting via http is meaningful? Is the broker also configured to accept WebSocket connections on port 80?
    – hardillb
    Aug 30, 2023 at 8:48
  • Is there any way you could capture the actual packets on either side? Your log tells us that packets were exchanged, but not their contents. Does it disconnect right away, or does it take some time before it does?
    – jcaron
    Aug 30, 2023 at 16:32
  • @hardillb it just to confirm that there is no problem on the sim module. the connection is stable
    – furqon2710
    Aug 31, 2023 at 3:42
  • Also, what protocol are you actually using? MQTT? HTTP? With or without TLS? The log above shows port 80...
    – jcaron
    Aug 31, 2023 at 12:26
  • 1
    So what is the relevance of the log you provided which apparently deals with a connection on port 80?
    – jcaron
    Sep 1, 2023 at 7:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.