lithium\net\socket\Context::timeout PHP Method

timeout() public method

Sets the timeout on the socket *connection*.
public timeout ( integer $time = null ) : booelan
$time integer Seconds after the connection times out.
return booelan `true` if timeout has been set, `false` otherwise.
    public function timeout($time = null)
    {
        if ($time !== null) {
            $this->_timeout = $time;
        }
        return $this->_timeout;
    }

Usage Example

 public function testGetSetTimeout()
 {
     $subject = new Context($this->_testConfig);
     $this->assertEqual(4, $subject->timeout());
     $this->assertEqual(25, $subject->timeout(25));
     $this->assertEqual(25, $subject->timeout());
     $subject->open();
     $this->assertEqual(25, $subject->timeout());
     $result = stream_context_get_options($subject->resource());
     $this->assertEqual(25, $result['http']['timeout']);
 }
All Usage Examples Of lithium\net\socket\Context::timeout