MQTT port 1883

  • 1
  • Question
  • Updated 2 years ago
I am trying to connect to a MQTT broker. I am able to make a GPRS connection but when trying to connect via MQTT, I get a PDP DEACT state error. 

The MQTT broker service suggested that port 1883 may not be open on the carrier end. Can you confirm whether port 1883 is open for traffic?

Thanks.
Jai
Photo of Jai Jaiprakash

Jai Jaiprakash

  • 14 Posts
  • 0 Reply Likes

Posted 2 years ago

  • 1
Photo of Bob Heckmann

Bob Heckmann, Official Rep

  • 349 Posts
  • 12 Reply Likes
Hi Jai,

Thanks for the question. Can you please provide your device ID and a screen shot of the error you're getting so we can take a closer look at the issue?

Regards,
Bob
Photo of Jai Jaiprakash

Jai Jaiprakash

  • 14 Posts
  • 0 Reply Likes
Hi Bob, Device ID : 
89185014080500177398

Error Log: 
Initializing FONA....(May take 3 seconds).---> AT
.<--- OK
.---> AT
.<--- OK
.---> AT
.<--- OK
.---> AT
.<--- OK
.---> ATE0
.<--- OK
.---> ATE0
.<--- OK
.---> AT+CVHU=0
.<--- OK
.---> ATI
.<--- SIM800 R13.08

OK

.---> AT+GMM
.<--- SIMCOM_SIM800L

OK

FONA is OK
Checking for network...
Enabling GPRS
.---> AT+CIPSHUT
.<--- SHUT OK
.---> AT+CGATT=1
.<--- OK
.---> AT+SAPBR=3,1,"CONTYPE","GPRS"
.<--- OK
.---> AT+SAPBR=3,1,"APN","neo.iot.net"
.<--- OK
.---> AT+SAPBR=3,1,"USER",""
.<--- OK
.---> AT+SAPBR=3,1,"PWD",""
.<--- OK
.---> AT+SAPBR=1,1
.<--- OK
Connected to Cellular!
.---> AT+CIPSHUT
.<--- SHUT OK
.---> AT+CIPMUX=0
.<--- OK
.---> AT+CIPRXGET=1
.<--- OK
AT+CIPSTART="TCP","io.adafruit.com","1883"
.<--- OK
.<--- STATE: PDP DEACT
.---> AT+CIPSTATUS
.<--- OK
.<--- STATE: PDP DEACT
Connecting to MQTT... .---> AT+CIPSHUT
.<--- SHUT OK
.---> AT+CIPMUX=0
.<--- OK
.---> AT+CIPRXGET=1
.<--- OK
AT+CIPSTART="TCP","io.adafruit.com","1883"
.<--- OK
.<--- STATE: PDP DEACT
Connection failed
Retrying MQTT connection in 5 seconds...
.---> AT+CIPSTATUS
.<--- OK
.<--- STATE: PDP DEACT
.---> AT+CIPCLOSE
.<--- +CME ERROR: operation not allowed
.---> AT+CIPSHUT
.<--- SHUT OK
.---> AT+CIPMUX=0
.<--- OK
.---> AT+CIPRXGET=1
.<--- OK
AT+CIPSTART="TCP","io.adafruit.com","1883"
.<--- OK
.<--- STATE: PDP DEACT
Connection failed
Thanks.
Jai
Photo of Vaibhav Mareddy

Vaibhav Mareddy, Official Rep

  • 24 Posts
  • 0 Reply Likes
Jai,

You are closing the GPRS connection, before initiating TCP session to MQTT server. 
" .---> AT+CIPSHUT
.<--- SHUT OK"

Check the AT commands for more details, one of the way to activate context is below:

AT+CGATT=1 --> to attach to GPRS N/W.
AT+CGACT=1,1 --> to activate PDP and get an IP address 
Photo of Jai Jaiprakash

Jai Jaiprakash

  • 14 Posts
  • 0 Reply Likes
As shown in the log, GPRS is connected via AT+CGATT=1. I will look into the AT commands once more and try not to deactivate the GPRS PDP context.

In any case, are you confirming that there is no issue with traffic going through port 1883 on your system? 
Photo of Vaibhav Mareddy

Vaibhav Mareddy, Official Rep

  • 24 Posts
  • 0 Reply Likes
Jai,
we do not block any traffic on that port.
Connection is closed after this commands:
.---> AT+SAPBR=1,1
.<--- OK
Connected to Cellular!
.---> AT+CIPSHUT
.<--- SHUT OK
Photo of Jai Jaiprakash

Jai Jaiprakash

  • 14 Posts
  • 0 Reply Likes
Thanks Vaibhav. The AT+CIPSHUT has been part of the code for a while to clear connections before reconnecting and it worked when I am trying to connect via HTTP but not MQTT, although both are TCP connections. Not sure why we're facing the issue. Will try to remove that sequence and retry.