I have an OpenGL application that plots data in real time. I would like to have a background TCP server that will accept data from a client without blocking on a call. The data is originally an array of 2048 doubles. Once this array of data arrives, I need to place it in a circular array buffer that is read from the foreground OpenGL program.
I initially tried the async TCP server code from Microsoft but this code blocks on the
I thought that this code would operate in the background but obviously not. So I need to run the server in a background thread and not block on a read. I could use a much simpler server since I only have one client at a time to deal with.
Now the circular array buffer is a static class. To write to it it is a simple
CircularBuffer.Write(double buffer); The class takes care of all indexes.
So what I need is a thread safe TCP server running in the background which can write to this circular buffer. I assume I might need to have some locking mechanism?
Can you suggest an over approach to this please?