Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Post Timeline

Commonmark migration
Source Link

Use socket.settimeout()

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
s.settimeout(1.0) 

This sets the timeout to 1 second.

socket.settimeout(value)

Set a timeout on blocking socket operations. The value argument can be a nonnegative float expressing seconds, or None. If a float is given, subsequent socket operations will raise a timeout exception if the timeout period value has elapsed before the operation has completed. Setting a timeout of None disables timeouts on socket operations. s.settimeout(0.0) is equivalent to s.setblocking(0); s.settimeout(None) is equivalent to s.setblocking(1).

Use socket.settimeout()

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
s.settimeout(1.0) 

This sets the timeout to 1 second.

socket.settimeout(value)

Set a timeout on blocking socket operations. The value argument can be a nonnegative float expressing seconds, or None. If a float is given, subsequent socket operations will raise a timeout exception if the timeout period value has elapsed before the operation has completed. Setting a timeout of None disables timeouts on socket operations. s.settimeout(0.0) is equivalent to s.setblocking(0); s.settimeout(None) is equivalent to s.setblocking(1).

Use socket.settimeout()

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
s.settimeout(1.0) 

This sets the timeout to 1 second.

socket.settimeout(value)

Set a timeout on blocking socket operations. The value argument can be a nonnegative float expressing seconds, or None. If a float is given, subsequent socket operations will raise a timeout exception if the timeout period value has elapsed before the operation has completed. Setting a timeout of None disables timeouts on socket operations. s.settimeout(0.0) is equivalent to s.setblocking(0); s.settimeout(None) is equivalent to s.setblocking(1).

added 38 characters in body
Source Link
rrauenza
  • 7.2k
  • 4
  • 39
  • 65

Use socket.settimeout()

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
s.settimeout(1.0) 

This sets the timeout to 1 second.

socket.settimeout(value)

Set a timeout on blocking socket operations. The value argument can be a nonnegative float expressing seconds, or None. If a float is given, subsequent socket operations will raise a timeout exception if the timeout period value has elapsed before the operation has completed. Setting a timeout of None disables timeouts on socket operations. s.settimeout(0.0) is equivalent to s.setblocking(0); s.settimeout(None) is equivalent to s.setblocking(1).

Use socket.settimeout()

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
s.settimeout(1) 

socket.settimeout(value)

Set a timeout on blocking socket operations. The value argument can be a nonnegative float expressing seconds, or None. If a float is given, subsequent socket operations will raise a timeout exception if the timeout period value has elapsed before the operation has completed. Setting a timeout of None disables timeouts on socket operations. s.settimeout(0.0) is equivalent to s.setblocking(0); s.settimeout(None) is equivalent to s.setblocking(1).

Use socket.settimeout()

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
s.settimeout(1.0) 

This sets the timeout to 1 second.

socket.settimeout(value)

Set a timeout on blocking socket operations. The value argument can be a nonnegative float expressing seconds, or None. If a float is given, subsequent socket operations will raise a timeout exception if the timeout period value has elapsed before the operation has completed. Setting a timeout of None disables timeouts on socket operations. s.settimeout(0.0) is equivalent to s.setblocking(0); s.settimeout(None) is equivalent to s.setblocking(1).

Source Link
rrauenza
  • 7.2k
  • 4
  • 39
  • 65

Use socket.settimeout()

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
s.settimeout(1) 

socket.settimeout(value)

Set a timeout on blocking socket operations. The value argument can be a nonnegative float expressing seconds, or None. If a float is given, subsequent socket operations will raise a timeout exception if the timeout period value has elapsed before the operation has completed. Setting a timeout of None disables timeouts on socket operations. s.settimeout(0.0) is equivalent to s.setblocking(0); s.settimeout(None) is equivalent to s.setblocking(1).

lang-py

AltStyle によって変換されたページ (->オリジナル) /