Socket communication

Hi,
I’m trying to implement a client-server mechanism through sockets. For me the server is a daq program and the client a GUI interface based on ROOT.
The server sends data with SendRaw (array of floats) inside a loop.
The point is that I would like to interromp this loop if the client GUI sends me a stop. How can I do that?

Sorry if this has been answered before…

Anyway thanks,
fernando.

The loop code:----------------------------

Bool_t Run=kTRUE;
while(Run) {
i++;
//send data
if (i != 0 && (i%kSEND) == 0 ) {
s->SendRaw(tab,kSEND*sizeof(Float_t));
}
}

Hi,

You can use TMonitor to monitor both write (i.e. send) and read (recv) activities on the socket, so that if the client sends something (like a stop signal) you can catch it and analyse it.

I have attached a simple example of client and server macros doing that.

Let me know if this helps in solving your problem.

G. Ganis
sock-example1.tar.gz (973 Bytes)