« NSPR API Reference « I/O Types
Structure used with the PR_SockOpt_Linger socket option to specify the time interval (in PRIntervalTime units) to linger on closing a socket if any data remain in the socket send buffer.
Syntax
#include <prio.h>
typedef struct PRLinger {
  PRBool polarity;
  PRIntervalTime linger;
} PRLinger;
Fields
The structure has the following fields:
- polarity
- Polarity of the option's setting: PR_FALSEmeans the option is off, in which case the value oflingeris ignored.PR_TRUEmeans the option is on, and the value oflingerwill be used to determine how longPR_Closewaits before returning.
- linger
- Time (in PRIntervalTimeunits) to linger before closing if any data remain in the socket send buffer.
Description
By default, PR_Close returns immediately, but if there are any data remaining in the socket send buffer, the system attempts to deliver the data to the peer. The PR_SockOpt_Linger socket option, with a value represented by a structure of type PRLinger, makes it possible to change this default as follows:
-  If polarityis set toPR_FALSE,PR_Closereturns immediately, but if there are any data remaining in the socket send buffer, the runtime attempts to deliver the data to the peer.
-  If polarityis set toPR_TRUEandlingeris set to 0 (PR_INTERVAL_NO_WAIT), the runtime aborts the connection when it is closed and discards any data remaining in the socket send buffer.
-  If polarityis set toPR_TRUEandlingeris nonzero, the runtime lingers when the socket is closed. That is, if any data remains in the socket send buffer,PR_Closeblocks until either all the data is sent and acknowledged by the peer or the interval specified bylingerexpires.
Document Tags and Contributors
    
    Tags: 
    
  
                    
                       Contributors to this page: 
        teoli, 
        alecananian
                    
                    
                       Last updated by:
                      alecananian,