contents   index   previous   next



Socket linger()

syntax:

socket.linger(flag[, timeout])

where:

flag - A boolean value indicating whether this socket will linger or not

 

timeout - A timeout, in seconds, to wait for when closing the socket, only used when linger is on. This defaults to 10 if not supplied.

 

return:

boolean - Whether the operation was successful

 

description:

If flag is true, then this socket is set to linger, otherwise it is not. A lingering socket will remain active after closing it if there remains data to be read or written. If linger is not set, then the socket will immediately close, but any remaining data will be sent, if possible, before closing the socket. If linger is active, and timeout 0, then the socket is immediately closed and any unsent data is lost, simulating a hard close. Otherwise, the socket remains open until the data is transferred or timeout is reached. By default, all sockets are non-lingering.

 

see:

#link <sesock>, Socket close()

 

 


Socket read()