What is the difference between close() and shutdown()?
Answer / chaitanya
Generally the difference between close() and shutdown() is: close() closes the socket id for the process but the connection is still opened if another process shares this socket id. The connection stays opened both for read and write, and sometimes this is very important. shutdown() breaks the connection for all processes sharing the socket id. Those who try to read will detect EOF, and those who try to write will reseive SIGPIPE, possibly delayed while the kernel socket buffer will be filled. Additionally, shutdown() has a second argument which denotes how to close the connection: 0 means to disable further reading, 1 to disable writing and 2 disables both.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the difference between close() and shutdown()?
Can a socket have multiple ports?
How do I send [this] over a socket?
What is socket programming in java?
What is socket address?
How many socket connections can a server handle?
How to find other end of unix socket connection?
How does a socket work?
How can I bind() to a port number < 1024?
Why does it take so long to detect that the peer died?
Can multiple clients connect to same socket?
What is Mac, and how is it different from PC? Which one is better for professional users, and why
1 Answers Evolving Systems, IBM,