Mbed-os: MQTT Network Socket Timeout Not Set

Created on 25 Jul 2019  路  4Comments  路  Source: ARMmbed/mbed-os

Description

I believe that both of these methods in the MQTTNetwork class should be setting the socket timeout based on the timeout passed. They are not.

Current:

 int read(unsigned char* buffer, int len, int timeout) {
        return socket->recv(buffer, len);
    }

 int write(unsigned char* buffer, int len, int timeout) {
        return socket->send(buffer, len);
    }

Proposed Fix:

 int read(unsigned char* buffer, int len, int timeout) {
    socket->set_timeout(timeout);
        return socket->recv(buffer, len);
    }

 int write(unsigned char* buffer, int len, int timeout) {
    socket->set_timeout(timeout);
        return socket->send(buffer, len);
    }

Issue request type

[ ] Question
[ ] Enhancement
[X] Bug
CLOSED mirrored bug

Most helpful comment

Hi @AriParkkila, sorry it's in the HelloMQTT example. Maybe this wasn't the right place for me to file a bug against an example versus the core OS?

https://os.mbed.com/teams/mqtt/code/HelloMQTT/file/e38aaf532823/MQTTNetwork.h/

All 4 comments

@JRubis I can't find MQTTNetwork class in Mbed OS?

Hi @AriParkkila, sorry it's in the HelloMQTT example. Maybe this wasn't the right place for me to file a bug against an example versus the core OS?

https://os.mbed.com/teams/mqtt/code/HelloMQTT/file/e38aaf532823/MQTTNetwork.h/

@JRubis Correct, please provide a pull request in the example.

I'll close this issue then.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrissnow picture chrissnow  路  4Comments

rbonghi picture rbonghi  路  3Comments

0xc0170 picture 0xc0170  路  3Comments

hasnainvirk picture hasnainvirk  路  3Comments

1domen1 picture 1domen1  路  3Comments