I wrote a small Webserver in C++. The Sockets are Non-Blocking and Keep-Alive is set to true as you can see here:
`/* Set socket to non-blocking */
unsigned long s_mode = 0;
ioctlsocket(server_socket, FIONBIO, &s_mode);
int optval = 1;
setsockopt(server_socket, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast<char*>(&optval), sizeof(int));
int optvalt = 1;
setsockopt(Client::client_machine_socket, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast<char*>(&optvalt), sizeof(int));`
I use select() while waiting for requests. After a while of inactivity the server stops answering my requests and i don't know what i did wrong... I hope you can help me!
Aucun commentaire:
Enregistrer un commentaire