Problem with sockets and SDL
The call to recv blocks until data is available. If you call recv on the same thread that does the rendering, your screen will not be updated.
To solve this, you can either use non-blocking I/O (Google has quite some arctiles on that), or run your network and rendering code in separate threads.
To solve this, you can either use non-blocking I/O (Google has quite some arctiles on that), or run your network and rendering code in separate threads.
Also, you should test the return value from recv(), because if there's some error, your loop will spin forever.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement