Advertisement
rfmonk

socket_timeout.py

May 12th, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. import socket
  5.  
  6. def test_socket_timeout():
  7.     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  8.     print "Default socket timeout: %s" %s.gettimeout()
  9.     s.settimeout(100)
  10.     print "Current socket timeout: %s" %s.gettimeout()
  11.  
  12. if __name__ == '__main__':
  13.     test_socket_timeout()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement