TLeconte / acarsdec

ACARS SDR decoder
338 stars 89 forks source link

Large JSON messages getting cut off #71

Closed fredclausen closed 3 years ago

fredclausen commented 3 years ago

I have been running your excellent decoder for a while now and have run in to an issue where the json network output appears to cut off part of the message and never sends all of data. The best that I can tell, any json message of more than 1400 characters will do this.

After testing, I believe I have narrowed the issue down to this line of code, where the buffer that is wrote to the network socket is 1400, while the rest of the output.c appears to use 3600 characters. When I compile the decoder with:

void outjson()
{
    char pkt[3600];

    snprintf(pkt, sizeof(pkt), "%s\n", jsonbuf);
    write(sockfd, pkt, strlen(pkt));
}

To match the convention used elsewhere in the file everything in my testing appears to work and messages are not cut off.