socket.shutdown vs socket.close

0 votes
I came across a bit of code that looked like the following :

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

What exactly is the purpose of calling shutdown on the socket and then closing it?
Jan 29 in Python by ana1504.k
• 6,630 points
35 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
Once a socket is no longer required, the calling program can discard the socket by applying a close subroutine to the socket descriptor. If a reliable delivery socket has data associated with it when a close takes place, the system continues to attempt data transfer. However, if the data is still undelivered, the system discards the data. Should the application program have no use for any pending data, it can use the shutdown subroutine on the socket prior to closing it.
answered Jan 29 by SDeb
• 10,700 points

Related Questions In Python

0 votes
1 answer

SKLearn NMF Vs Custom NMF

The choice of the optimizer has a ...READ MORE

answered May 9, 2018 in Python by charlie_brown
• 7,710 points
247 views
0 votes
1 answer

Difference between append vs. extend list methods in Python

append: Appends object at end. x = [1, ...READ MORE

answered Jun 4, 2018 in Python by ariaholic
• 7,320 points
123 views
+2 votes
2 answers

Compiled vs Interpreted Languages

Compiled languages are written in a code ...READ MORE

answered Dec 3, 2018 in Python by allenvarna
• 520 points
183 views
0 votes
1 answer

Difference between append vs. extend list methods in Python

append: Appends object at the end. x = ...READ MORE

answered Aug 8, 2018 in Python by bug_seeker
• 14,980 points
61 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
54 views
0 votes
1 answer

When to use file vs open in Python?

File() has been removed since Python 3.0 ...READ MORE

answered Oct 30, 2018 in Python by SDeb
• 10,700 points
20 views
0 votes
1 answer

df.mul vs df.rmul in Pandas

The documentation is not identical. As stated ...READ MORE

answered Jan 18 in Python by SDeb
• 10,700 points
68 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.