Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing Connection Timeout status on curl

Tags:

linux

curl

I want to test whether my curl command really return "Connection Timeout" status or not. Therefore I want to try to run curl --connect-timeout 1 connect to any website that need more than 1 second to response in order for curl to timed out. But after trying to numerous website, I still couldn't get connect timeout status (because they responded so fast?). How do you suggest me to be able to accomplish this?

like image 424
Chen Li Yong Avatar asked Oct 28 '25 09:10

Chen Li Yong


1 Answers

It's ok, I've searched through the stack overflow and find that you can use non routable IP address to simulate this.

E.g. ping 10.255.255.1 or ping 127.255.255.1 or ping 192.168.255.1 all will return request timed out response.

like image 65
Chen Li Yong Avatar answered Oct 31 '25 02:10

Chen Li Yong