-
Need help with winsock2
i am doing a server/client program with winsock2. once a client starts, it will connect to server and send some info. after server got these info,the connection will be closed,and the server will waiting for another client.
now i wanna make sure that, once the server-socket accept a connection,this connection won't last more than 10 seconds. if one connection lasts more than 10 seconds,then the server-socket should close the connection automatically. is there anyway to set that time limit? any suggestion would be greatly appreciated.......
-
you can set read and write timeouts, but if you want to limit the connection time to 10 seconds, you will need to do something like spawn a separate thread for each connection, have it sleep 10 seconds and then close the socket if it hasn't been closed yet.
-
Thanks, rockytriton.
one more question: how to set the read time-out ?
-
-