- Method
close
int close(void|string how, void|int clean_close, void|int dont_throw)
- Description
Close the connection. Both the read and write ends are always
closed - the argument how is only for Stdio.File
compatibility and must be either "rw"
or 0
.
If clean_close is set then close messages are exchanged to shut
down the SSL connection but not the underlying stream. It may then
continue to be used for other communication afterwards. The
default is to send a close message and then close the stream
without waiting for a response.
I/O errors are normally thrown, but that can be turned off with
dont_throw . In that case errno is set instead and 0 is
returned. 1 is always returned otherwise. It's not an error to
close an already closed connection.
- Note
In nonblocking mode the stream might not be closed right away and
the backend might be used for a while afterwards. This means that
if there's an I/O problem it might not be signalled immediately by
close .
- Note
I/O errors from both reading and writing might occur in blocking
mode.
- Note
If a clean close is requested and data following the close message
is received at the same time, then this object will read it and
has no way to undo that. That data can be retrieved with read
afterwards.