Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python closing socket good way

from contextlib import closing

    try:    
        with closing(sock):
           sock.shutdown()
    except OSError:
        pass
Source by news.ycombinator.com #
 
PREVIOUS NEXT
Tagged: #python #closing #socket #good
ADD COMMENT
Topic
Name
6+2 =