I have a machine that communicates through UDP. So, I send it an UDP message that says: "Start connection", and from that moment on it will start spamming that port with lots of data.
But AFAIK, I can not send data over a socket while I'm listening to it. Should I listen for just a few milliseconds, and then peek if there is a message to send in the queue, etc? That seems very inefficient.
Or do I have to do everything asynchronously with callbacks, all in the same thread? That's a lot of extra code.
What is the easiest way? I use Synapse ATM, but if there is something better for this, I'll use it.