PDA

View Full Version : Special loging class



cszawisza
20th May 2014, 16:29
Hi

I'm writing an application that communicates wits some machine using TCP/IP for control and UDP for measurement messages, using nanoPB protocol and couple of different messages types.
In other words. My machine is doing something, and sends me measurements every couple of ms, and from time to time I'm sending to it some control data (a order to do something, or some different kind of message), those are not big amount of data, but they had a quite high frequency, so I can/t store the data directly to database because of disk IO. Everything shroud work exactly as in a plane blackbox, every packet should be saved as a normal bytearray, or something else, with exact time of transmission and some other info (that's why I want to use a sql database).
I'm not worrying about some cache mechanism, but about how I should do this? Should I create my own "QTcpSocket" with two way logging, or simply just save everything when sending/reciving data to/from my machine? Are there any design patterns to deal with such problem?