How to inform the server if a client is interrupted, and then close the socket?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the other end of a socket is closed, your end will be marked as readable and return
0fromread– this is the “end of file” indication.If you try to
writeto such a socket, you will recieve theSIGPIPEsignal, and thewritewill return error with errno set toEPIPE(“Broken Pipe”). You must be prepared to handle this event, because the other end can close the socket at any time.