I think I might have solved the occasional problem with lockups in the SDL console (C-version, converted to single camera), here's my code to receive the image (no lockups for a whole day):
Code:// look for frames
while (!imageReady) {
if (!imageReady) {
nrSocketsReady = SDLNet_CheckSockets(socSet, TIMEOUT);
if (nrSocketsReady == -1) {
printf("SDLNet_CheckSockets: %s\n", SDLNet_GetError());
perror("SDLNet_CheckSockets");
}
else if (nrSocketsReady > 0) {
if (SDLNet_CheckSockets(socSet, TIMEOUT)) {
if (SDLNet_SocketReady(socSet)) {
result = SDLNet_TCP_Recv(tcpsock, buf, MTU);
memcpy(imageBuf+index, buf, result);
index += result;
if ((buf[result-2] == -1) && (buf[result-1] == -39))
imageReady = 1;
}
}
}
else {
printf("\n\rNo sockets ready.\n\r");
break;
}
}
}
If there's a timeout, the current frame will be skipped, and no update will occur until the request of a new frame.