socket_set_timeout

bool socket_set_timeout(resource socket_descriptor, int seconds, 
int microseconds) 
socket_descriptor Socket descriptor
seconds Number of seconds
microseconds Number of microseconds

Sets the timeout for an open socket.

Returns:

TRUE on success; FALSE otherwise

Description:

socket_set_timeout() sets the timeout value for an open socket. The timeout value is the sum of the seconds and microseconds arguments.

Availability:

UNIX, Windows

Version:

4.0b4+

See also:

To get information about the state of a socket:

socket_get_status() 

Example:

23.18. Change the timeout for a socket
socket_set_timeout ($socket_descriptor, 0, 500) 
    or trigger_error ('Socket timeout could not be altered'); 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.