|Re: [paho-dev] mqtt.embedded-c/MQTTPacket/ samples and src/MQTTPacket.c
Hi Sergio,then I think we should separate the samples out by OS similarly to the MQTTClient directory, which has arduino, linux and mbed sample directories. The directories here wouldn't necessarily be the same as in MQTTClient. The current samples could be in a desktop-linux directory, and you could create a new one, embedded-linux (or whatever you would like to call them).
How does that sound?Over time, I envisage samples for all sorts of embedded, realtime OSs. I guess samples become utilities when they become generally useful enough.
At the moment, TCP is the only supported transport for MQTT, although the samples might be different for cabled and wireless connections.
Ian On 09/19/2014 02:35 PM, Sergio R. Caprile wrote:
But in pub0sub1.c, the timeout value for reading is set to 1 second.Can'tyou increase that timeout value to sufficiently long that the reads will complete?Hi Ian, yes, I could, but that would mean that function call would block (at transport_getdata()) until the expected amount of data arrives, or the timeout occurs. Even though the sample would work on my Linux now, this is embedded code and non-RTOS users (like me) would swear at this code when run on bare metal. MQTT packet reader assumes the required amount of data is present for the needed processing (ID, packet length, etc), and that is not true for at least one of the supported transports: TCP (are there any others?) My usual approach for small messages over TCP is an intermediate buffer to collect the data. 256 bytes should not be overkill for a system having a TCP/IP stack with TCP, and the approach should be less cumbersome than peeking if the underlying stack doesn't have this capability right away. Anyway, peeking can be added later if needed. I can do the mods if you agree (and can wait for me) Best regards _______________________________________________ paho-dev mailing list paho-dev@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/paho-dev
-- Ian Craggs icraggs@xxxxxxxxxx IBM United Kingdom Committer on Paho, Mosquitto
Back to the top