Question Details

No question body available.

Tags

php sockets timeout

Answers (1)

January 3, 2026 Score: 2 Rep: 30,256 Quality: Low Completeness: 70%

The name socketsettimeout is misleading, but if you read the manual, you will find that it is not part of the Sockets extension. You need to use the socketsetoption method to set the timeout:

# set the send timeout socketsetoption($socket, SOLSOCKET, SOSNDTIMEO, ['sec' => 2, 'usec' => 0]);

set the receive timeout

socketsetoption($socket, SOLSOCKET, SORCVTIMEO, ['sec' => 2, 'usec' => 0]);