Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - megani

Pages: [1]
1
Network / Re: Waiting for an incoming message for a certain time.
« on: February 21, 2019, 06:06:49 pm »
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);
        }

}

2
Network / Waiting for an incoming message for a certain time.
« on: February 21, 2019, 05:26:48 pm »
Is it possible to wait for a certain time for an incoming message. And if none comes, to get a signal?

I'm using Tcp Sockets and the receive function.


Pages: [1]
anything