Two quick queries:
1. I have programmed a little network performance monitor. It monitors
a set of remote hosts over a network. It gets the CPU statistics and
all gets collected at one of the remote hosts (say primary remote host,
holding procValues[n][4], 4 CPU floating numbers per n remote hosts).
Now, I want to transfer this data set (double procValues[n][4]) over a
TCP or UDP network connection to a local host for graphing and storing
in a database tool.
I've read Beej's Networking Guide
http://www.ecst.csuchico.edu/~beej/guide/net/ and going to follow his
code.
However I don't know how am going to send a double[n][4] over the
network efficiently without hogging the network. Is the most efficient
way just converting double[n][4] into a string?
Am using a sleep(1) function to set the frequency of 1 second to read
the cpu statistics.
If a sending function takes more than the frequency of "cpu statistic
collecting" then am going to get lots of missed out data... no wait it
wouldn't be perfectly synchronized to the exact second, it will be
lagged behind. Maybe thread the network transfer so that the frequency
of "cpu collecting" remains precisely every second?
What are your views?
2. How does one create/use threads in C, AND C++? Do threads differ in
usage in C and C++?