This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

publising big MQTT msgs

Hi, 

I have modyfied the MQTT example to, so I can send data to my own AWS account.

I'm trying to publish big packets of data, (> 7K) without luck .

what I have done is :

1. change CONFIG_MQTT_MAX_PACKET_LENGTH to 8500

2. modify client_write, the following way, 

static int client_write(struct mqtt_client *client, const u8_t *data,
                        u32_t datalen)
{
        int err_code=0;
        u32_t tmplen=datalen;
        u8_t* tmpdata=data;
        MQTT_TRC("[%p]: Transport writing %d bytes.", client, datalen);

        MQTT_SET_STATE(client, MQTT_STATE_PENDING_WRITE);

        do {
        if (tmplen > MAX_SEND_SIZE_SCK)
        {
                err_code += mqtt_transport_write(client, tmpdata, MAX_SEND_SIZE_SCK);
                tmplen -= MAX_SEND_SIZE_SCK;
                tmpdata += MAX_SEND_SIZE_SCK;
                if (err_code) printk("failed with errorcode : %d\n",err_code);
                else
                        printk("all_ok!\n");
        }
        else
        {
                err_code += mqtt_transport_write(client, tmpdata, tmplen);
                break;
        }
        } while (1);
        MQTT_RESET_STATE(client, MQTT_STATE_PENDING_WRITE);

        if (err_code != 0) {
                printk("TCP write failed, errno = %d, "
                         "closing connection\n", errno);
                client_disconnect(client, err_code);
                return -EIO;
        }

        MQTT_TRC("[%p]: Transport write complete.", client);
        client->last_activity = mqtt_sys_tick_in_ms_get();

        return 0;
}

I still get :

TCP write failed, errno = 12, closing connection

any idea why? 

Parents Reply Children
No Data
Related