@Xatyrian said in How to use QSocketNotifier on write mode on sockets:
all the time even if there is nothing that has been written !
It is right behavior, please read how its work (e.g. about select() and so on).
It need to use like this (e.g. for writing):
Add data to be written to some internal buffer.
Enable the write notifier.
When the write notifier fired, just take all data from the buffer and send to ::send/::write.
When the write notifier fired again, check for p.3.. If a buffer is empty - just disable wrute notifier.
AFAIK, there are no ways to know that the data are written physically, to client.
BTW: You can use qtserialbus module which implements the SocketCAN support (as I can see from your tag), just use a newest Qt version, as 5.3 is too old.