TCP Server and threading/callback/event handling

Hi,

I’m pretty new to open frameworks. I’m trying to create a TCP server but I’m listening for new messages in the wrong place. I want to basically:

Via setup make a callback or event handler to wait for incoming tcp messages and handle connect/disconnect

This callback or event handler will wait for new messages, when available copy them to a vector accessible in anywhere in the app.

In Update read the last 512 numbers from the stream which will be stored in a vector. Then I can use this to do calculations or use it in Draw.

Right now I’m checking for a new message in Update which is problematic because it’s only running every 1/30th or 1/60th of a second then acknowledging which is hanging my program sending the tcp stream.

Using ofThread and putting my TCP routines inside it worked. Then calling the threaded class from the main setup works well.

Hey! Having very similar problem and asked same question couple days ago.
Glad that it worked for you, will try to move TCP handling in a separate thread…