This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can't connect to client in MQTT client server example

Other Parts Discussed in Thread: CC3200

Hi everyone, 

I'm trying to get the MQTT client/server example working (SDK 1.2.0). It's compiling fine and runs on the CC3200 launchpad, but I don't seem to be able to connect to the client. (I made a small change to the example: when an error occurs, the application doesn't exit.)

I have created a setup very similar to the one described for the example. The CC3200 is connected as a STAtion to a TP-Link Access Point, along with two other devices: an Android phone and an Android tablet both running MyMQTT. I've pointed both of them to the CC3200, to use the Application Server as their "broker". See this picture: 

(Please note: the TP Link is not connected to the internet.)

The phone on the left and the tablet on the right can see each other's messages through the Application Server (AS) when they subscribe to the appropriate topics. The Application Client (AC), which is supposed to be running on the CC3200, does not see any of the messages, even when I subscribe to the appropriate topics. 

It seems the client doesn't work without an external broker (timeout?), but that may be speculation on my part. 

I am however confused about how the Application Client and Application Server (both running on the CC3200) would exchange messages, and what I should change in the example to get any messages to flow from either phone or tablet to/from the Application Client. Should I change the Client config to connect to the Server, or is that handled in a different way? 

Can anyone shed some light on this? Any help would be much appreciated. :-) 

  • Humm.. Did, you make sure the 'server address' provided for AC is on device AS?
  • Hari Nagalla said:
    Humm.. Did, you make sure the 'server address' provided for AC is on device AS?

    Thanks for you reply, Hari. Yes, I've tried "localhost", "127.0.0.1" and the actual IP address "192.168.0.101" in the AC settings. 

    /Sander

  • Okay, the solution for me was to ditch the Application Client altogether,  because we don't need an external broker anyway. By calling

    sl_ExtLib_MqttTopicEnroll(ENROLLED_TOPIC1);

    we basically "subscribe" to a topic, and we can use the Server's callback function to handle any message coming in on that topic. 

    For outgoing messages, we simply call 

     sl_ExtLib_MqttServerSend(...)

    and as long as we don't inadvertently subscribe to the same topic in the server (which would lead to a publish storm), we're golden. :-) 

    Thanks for the suggestions so far! 

    /Sander