timeval

Contains timeout values for search requests.

Structure

  typedef struct timeval {
     long   tv_sec;
     long   tv_usec;
  };
  

Fields

tv_sec

Specifies the number of seconds for the time interval component.

tv_usec

Specifies the number of microseconds for the time interval component.

Remarks

These fields are used to determine the timeout value for both the LDAP server and the LDAP client libraries:

  • If the server timeout expires before the server finishes the search operation, the server returns LDAP_TIMELIMIT_EXCEEDED to the application.

  • If the client timeout expires before the server returns, the client returns LDAP_TIMEOUT to the application and sends an ldap_abandon to the server.

These fields have the following meanings for the timeout value for the LDAP server.

Field Values

Description

tv_sec=0; tv_usec>0

Sends a timeout value of one second to the server.

tv_sec>0; tv_usec>=0

Sends the tv_sec value to the server. The server ignores the tv_usec field.

The fields have the following meaning for a client timeout value.

Field Values

Description

tv_sec>=0; tv_usec>=0

Waits the time specified by the combination of the tv_sec and tv_usec fields.

The following table shows potential values for the fields and the timeout value that is computed for the server and the client.

Field Values

Server Timeout Value

Client Timeout Value

tv_sec=0; tv_usec=1

1 second

1 microsecond

tv_sec=1; tv_usec=500000

1 second

1.5 seconds

tv_sec=2; tv_usec=0

2 seconds

2 seconds

Only one of the fields can be set to zero. When both the tv_sec and tv_usec fields are set to zero, LDAP returns LDAP_PARAM_ERROR.