moonbridge
diff reference.txt @ 94:de3982f17d05
Removed timeout option from socket:close(); Simulate shutdown for local sockets (Unix Domain Sockets)
author | jbe |
---|---|
date | Tue Apr 07 22:17:13 2015 +0200 (2015-04-07) |
parents | de0e69673953 |
children | acaa85256c4b |
line diff
1.1 --- a/reference.txt Tue Apr 07 04:08:41 2015 +0200 1.2 +++ b/reference.txt Tue Apr 07 22:17:13 2015 +0200 1.3 @@ -52,23 +52,19 @@ 1.4 a single socket object as argument, which is described below: 1.5 1.6 1.7 -### socket:close(timeout) 1.8 +### socket:close() 1.9 1.10 Closes the socket connection (input and output stream) by flushing all data and 1.11 -sending a TCP FIN packet. If the timeout value is non-nil but zero, a TCP RST 1.12 -is sent instead. If a positive timeout value is given and if the remote peer 1.13 -doesn't respond with a TCP FIN within the given time, a TCP RST is sent in 1.14 -addition to the previously sent TCP FIN packet. If the timeout value is nil or 1.15 -negative, the call returns immediately and the operating system will wait for 1.16 -the peer's TCP FIN packet. 1.17 +sending a TCP FIN packet. 1.18 1.19 Returns true on success, or nil plus error message in case of an I/O error. 1.20 Using this method on sockets that have already been closed (or reset) will 1.21 throw an error. 1.22 1.23 Warning: Pending data on the input stream may cause connection aborts (TCP RST) 1.24 -depending on the particular operating system used. All pending input data 1.25 -should have been read (or drained) before calling socket:close(). 1.26 +when network connections are used. All pending input data should have been read 1.27 +(or drained) before calling socket:close(). Use socket:finish() to send a 1.28 +TCP FIN packet to the peer before waiting for EOF from the peer. 1.29 1.30 1.31 ### socket:drain(maxlen, terminator) 1.32 @@ -91,6 +87,17 @@ 1.33 second result value) are returned. 1.34 1.35 1.36 +### socket:finish() 1.37 + 1.38 +Sends a TCP FIN packet to indicate EOF on write stream. Subsequent reads are 1.39 +still possible. When there is no more input data to be read, the connection 1.40 +should finally be closed with socket:close(). 1.41 + 1.42 +In case of local sockets (Unix Domain Sockets), socket:finish() simply closes 1.43 +the underlying socket and emulates EOF on subsequent reads. Also in this case, 1.44 +the connection should be finally closed with socket:close(). 1.45 + 1.46 + 1.47 ### socket:flush(...) 1.48 1.49 Same as socket:write(...) but additionally flushes the socket (i.e. all pending