Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] External loop with poll()

Hi Zoltan,

You should use mosquitto_want_write() (or a similar name, I'm on my phone and going on memory) to find out when the client wants to write.

Cheers,

Roger


On 14 Sep 2016 4:58 p.m., "Zoltan Gyarmati" <mr.zoltan.gyarmati@xxxxxxxxx> wrote:
Dear All,

I'm trying to integrate a libmosquitto client into my application built around poll() and mosquitto_loop_write() and co.
Here is the relevant excerpt of the code:
https://gist.github.com/zgyarmati/fa2e2be391c664f35bd2ccac5c4cad3a

I got confused about the needed events flags: if i set only POLLIN at line #89 (and #114) at the first PINGREQ the client dis- and reconnects (I assume it can't send out the request, so it won't get answer to it neither), but if i set "POLLIN | POLLOUT", the poll always returns instantly
 (regardless if actual event was happening) with the mosquitto socket's fd, pushing the CPU to 100%.
What do i miss here?

Thanks in advance, regards

-- 
Zoltan Gyarmati
https://zgyarmati.de

_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev

Back to the top