# timeout-constraint

Tag: timeout-constraint

Defines a named timeout constraint that can then be referenced from other places of the Ivy settings file, like the resolvers.

## Attributes

Attribute | Description | Required
--- | --- | ---
name | name of timeout constraint | Yes

connectionTimeout

An integer value, in milliseconds, that will be used as the timeout while establishing a connection.
A value greater than `0` is used literally as the timeout.
A value of `0` indicates no timeout and typically translates to wait-forever kind of semantics.
A value less than `0` lets the users of this timeout constraint decide what semantics to use. That effectively, implies implementation specific semantics

No, defaults to `-1`

readTimeout

An integer value, in milliseconds, that will be used as the timeout while reading content from a resource to which an connection has been established.
A value greater than `0` is used literally as the timeout.
A value of `0` indicates no timeout and typically translates to wait-forever kind of semantics.
A value less than `0` lets the users of this timeout constraint decide what semantics to use. That effectively, implies implementation specific semantics

No, defaults to `-1`

## Examples

        <timeout-constraints>
            <timeout-constraint name="test-timeout-1" connectionTimeout="100" readTimeout="500"/>
            <timeout-constraint name="test-timeout-2" readTimeout="20"/>
            <timeout-constraint name="test-timeout-3" connectionTimeout="400"/>
            <timeout-constraint name="test-timeout-4"/>
        </timeout-constraints>

Here we see 4 timeout constraints defined:

- `test-timeout-1` uses a connection timeout of 200 milliseconds and read timeout of 500 milliseconds.

- `test-timeout-2` uses a read timeout of 20 milliseconds and lets the connection timeout default to -1.

- `test-timeout-3` uses a connection timeout of 400 milliseconds and lets the read timeout default to -1.

- `test-timeout-4` lets both the connection timeout and read timeout default to -1.