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, 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I still get :

TCP write failed, errno = 12, closing connection

any idea why? 

Parents
  • Hi Moshe,

    The TLS output buffer has a size of 2kB, and there is a bug that you do not get a notification that the messages are too big. (this will be fixed)

    So the solution is to have shorter messages.

    Best Regards,
    Martin L.

Reply
  • Hi Moshe,

    The TLS output buffer has a size of 2kB, and there is a bug that you do not get a notification that the messages are too big. (this will be fixed)

    So the solution is to have shorter messages.

    Best Regards,
    Martin L.

Children