IPWorks SSH 2020 Node.js Edition

Questions / Feedback?

Linger Property

When set to True, connections are terminated gracefully.

Syntax

 sshtunnel.getLinger([callback])
 sshtunnel.setLinger( linger, [callback])

Default Value

TRUE

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for the getLinger([callback]) method is defined as:

function(err, data){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'data' is the value returned by the method.

The callback for the setLinger([callback]) method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

This property controls how a connection is closed. The default is True. In this case the connection is closed only after all the data is sent. Setting it to False forces an abrupt (hard) disconnection. Any data that was in the sending queue may be lost.

The default behavior (which is also the default mode for stream sockets) might result in an indefinite delay in closing the connection. Although the class returns control immediately, the system might indefinitely hold system resources until all pending data is sent (even after your application closes). This means that valuable system resources might be wasted.

Setting this property to False forces an immediate disconnection. If you know that the other side has received all the data you have sent (by a client acknowledgment, for example), setting this property to False might be the appropriate course of action.

This property is shared among incoming connections. When the property is set, the corresponding value is set for incoming connections as they are accepted. Existing connections are not modified.

Data Type

Boolean

Copyright (c) 2023 /n software inc. - All rights reserved.
IPWorks SSH 2020 Node.js Edition - Version 20.0 [Build 8501]