socket.shutdown vs socket.close

Posted by Jason Baker on Stack Overflow See other posts from Stack Overflow or by Jason Baker
Published on 2009-01-03T20:37:55Z Indexed on 2010/04/09 8:23 UTC
Read the original article Hit count: 337

Filed under:
|
|

I recently saw a bit of code that looked like this (with sock being a socket object of course):

sock.shutdown(socket.SHUT_RDWR)
sock.close()

What exactly is the purpose of calling shutdown on the socket and then closing it? If it makes a difference, this socket is being used for non-blocking IO.

© Stack Overflow or respective owner

Related posts about python

Related posts about sockets