Reputation: 1
I am currently using socket.recv
to recieve a message from a server with my client. Is there any way, if no message has been recieved for 5 seconds, to display a custom error and close the connection + client?
Upvotes: 0
Views: 263
Reputation: 19375
Use socket.settimeout()
before you perform a blocking operation to control its timeout. So in your case it sounds like you don't want a timeout for connect()
, but one for recv()
.
Upvotes: 1