Home Contents | # rawio:shutdown | Rawio | Core4 Lua Event System

## SYNOPSIS

flag = handle:shutdown([how])

## DESCRIPTION

This call causes all or part of a full-duplex connection to be shut down. If how is "rd", receiving from the socket is shut down, if it is "wr", sending to the socket is shut down and if it is "rdwr", the complete connection is shut down. The default is "rdwr".

When a connection has been shut down for reading, then further read attempt will first return any data that is still in the buffers, then signal an end-of-file condition.

When a connection has been shut down for writing, then further write attempts will fail. The peer of the connection will see this as a read shutdown, i.e. it will see an end-of-file once all buffered data has been read.

All shutdowns are final. The connection cannot be re-opened once it has been shutdown.

## RETURN VALUE

On success, returns true. On failure, returns nil. In case of an error, the error can be retrieved using rawio:lastError().

## NOTES

While shutdown closes the connection, the socket handle continues to exists. To close the handle, call rawio:close(), which also does an implied shutdown("rdwr").

## SEE ALSO

rawio:accept, rawio:bind, rawio:getsockopt, rawio.ifconfig, rawio.interfaces, rawio:listen, rawio:recvfrom, rawio:sendto, rawio:setsockopt, rawio.socket