GotBatteries
GotBatteries

Reputation: 1386

How to test curl "CURLOPT_CONNECTTIMEOUT"

Is there any way of testing CURLOPT_CONNECTTIMEOUT?

I have a curl that has this line:

curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5 );

But how to test that it actually tries to connect for 5s and only after then it stops trying to connect and moves on?

If I shut down the server, curl doesn't wait at all because it thinks there is no need to. If I put the requested php-script to sleep, curl waits for that sleep-time, because there is connection but the script is just taking so long.

I use local WAMP-server as the one who calls, and the call is sent to local php-server with symfony.

Upvotes: 0

Views: 1023

Answers (1)

Miloš
Miloš

Reputation: 606

It can be tested if curl connects to a non-routable IP address 10.255.255.1.

Upvotes: 3

Related Questions