David wrote:
I have one other questions... If you have a connected socket, and you
do a read, but get 0 bytes. Is it safe to close the socket? I know
that a 0 length read means a closed socket, but shouldn't you call
PR_Close to clean up the memory?
Here is a diagram:
socket <--------connection---------> socket
Sockets are endpoints of a connection.
When a read returns 0 bytes, it means the peer has
closed the connection. Your socket is still open,
and therefore still needs to be closed.
The confusion arises because the usual way to
close a connection is to close your socket.
But in this case, it is the peer's socket that
has been closed. Your socket is still open.
Wan-Teh
_______________________________________________
mozilla-crypto mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-crypto