I did discover the SDLNet_CheckSockets(socSet1, TIMEOUT) call in your code, and this seems to have resolved the problem. I am also comparing image headers to actual number of bytes read, so there is validation of the image, similar to what you did in your parsing code. It does seem to be handling timeouts and most of the error conditions, though a bad frame is still getting through occasionally and causing a crash, so I need to look a bit more closely at my error checking.
My updated version is here -
http://www.surveyor.com/stereo/stereo.c That's a great idea about changing the cursor. I do have code to check for mouse clicks ...
case SDL_MOUSEBUTTONUP:
if(event.button.button == SDL_BUTTON_LEFT){
printf("X: %d Y: %d\n", event.button.x, event.button.y);
}
break;
but at the moment I only print out the mouse coordinates rather than initiating any action.
=================
update - I made one small change to the control loop which seems to have fixed the image errors - the console has been running continuously for an hour. the next remaining step is to add error recovery code in case the TCP connection completely breaks