python - Check if a socket is closed after sock.shutdown(SHUT_WR)? -


By my understanding of a dragon socket, one reading end and one typed ends. I also understand that you can close a half socket (on some systems) Also, you can check in the python if a socket is sending an exception by checking something out.

I was wondering if there was any way of "reliable" investigation that after a server stopped the "write" end of the socket, the end of the "read" socket, the customer had to close the socket.

For example, if a server was running, and this is the client code:

  sock.shutdown (socket.SHUT_WR) # I want to check that I can still read the code in the socket at this point.   

Is this possible?

I think a dragon socket, a reading end and a write end.

No socket full-duplex, bidirectional, reading / writing, ...

I also understand that you have a half socket ) Can be closed.

You can either stop to read or write.

In addition, you can check in the python if a socket is stopped by sending something and checking the exception.

You can check by given and by peer by sending anything >

I was thinking that if there was a way to check "reliable" that if a "read" of a server socket closes the end, then the customer closes the end of the "write" of the socket have make.

If you are a server, then you do not need a check, because you are the one who had shut down if you are a subscriber, then you can not send anything, so you can not check . For example, if a server was running, and this is the client code:

  sock.shutdown (socket.SHUT_WR)   

I want to check this Am I still able to read in the code from socket at this point.

The only way to tell that you can still read from the socket is to try to read from the socket. If the colleague has closed the socket, or has stopped half to send it, then you will get the end of the stream, though it appears in your language. This is not what you were asking upstairs: There you were asking the server colleague to stop to read their socket.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -