Atom

net.shutdown()

Ends writes on a TCP connection.

Signature

net.shutdown(socket)

Parameters

Connected TCP socket.

Returns

Null.

Behavior

Sends TLS close notification when applicable, then shuts down writes. Read and close remain available after success.

Errors

Invalid receiver, TLS or OS failure. Timeout/interruption can close the socket.

Example

Atom
use net
l = net.listen('127.0.0.1', 0, {timeout = 2})
c = net.connect('127.0.0.1', net.local(l).port, {timeout = 2})
p = net.accept(l)
net.shutdown(c)
assert(count(read(p)) == 0)
net.close(p)
net.close(c)
net.close(l)