0

I'm making a request for a socket but when it's offline socket_connect takes around 60s to inform me time out, is there any way I do not have to wait all this time when it's offline?

Sorry for the grammar. I'm using a translator.

1

1 Answer 1

0

You can set the time it waits for the connection to establish:

ini_set('default_socket_timeout', 10);

for a 10 second timeout.

Or you can set it in php.ini.

Sign up to request clarification or add additional context in comments.

2 Comments

i change on php ini to set ; Default timeout for socket based streams (seconds) ; php.net/default-socket-timeout default_socket_timeout = 5 and i add on code ini_set('default_socket_timeout', 5); Even more in execution it tries 60s with the socket
That is probably because it cant connect. The a timeout wont work. see stackoverflow.com/questions/16689932/… for a non-blocking socket connection with a timeout

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.