Name

setDefaultSocketTimeout

Synopsis

setDefaultSocketTimeout(s)

Sets the default timeout value, used for newly created instances of class TimeoutSocket, to s seconds. s is a float or None.

Socket methods that may block and wait forever when you call them on normal sockets, such as connect, accept, recv, and send, may time out when you call them on an instance t of TimeoutSocket with a timeout value s that is not None. If s seconds elapse after the call, and the wait is still going on, then t stops waiting and raises timeoutsocket.Timeout.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.