first of all many thanks for your amazing work with Cinder. I’ve been using it since a few years now.
I run into a problem using Cinder-Asio - it may be lack of knowledge.
While TCP-Communictaion between a server and a client i get the following error-message after a while:
“An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.”
Is a TCP-Session supposed to be closed after every message/communication?
Is UDP a better choice for a steady client/server state request?
Regards from Berlin.
without knowing specific details about your code, it’s safe to say that it’s probably a matter of not reading (or writing) your network messages often enough. All network code uses memory buffers to write messages to and store messages received. But it’s then up to you to process those messages and remove them from the buffer before it gets filled to the brim.
Not sure if ASIO is prone to this issue, but one thing I ran into in the past that caused a buffer overflow was something like this:
if( hasMessageReceived )
, which would simply read a single message per update. That, of course, caused an overflow as soon as I started to receive thousands of little messages per second. This would have been better (and solved the problem):
while( hasMessageReceived )
FYI: a TCP should not be closed after every message. It’s why you’re using TCP in the first place: to keep the connection alive. UDP is connection-less, so you simply send a message and you don’t really care about the receiver at all. UDP is faster, but more prone to errors, especially on a busy network or over long distances.