I wrote this, but im not sure, if it will work. (Its a running thread!).
void getPoints(TcpSocket* client, int *points) {
char rec[100];
size_t received;
int i;
client->setBlocking(false);
while (client->receive(rec, 100, received) == Socket::NotReady && i < 5000) {
sleep(milliseconds(10));
i++;
}
if (strlen(rec) != 0) {
*points = atoi(rec);
}
}