Пример #1
0
 /**
  * opens secure socket using ssl to this ip address
  *
  * @param   int       $port      port to connect to
  * @param   int       $timeout   optional  connection timeout
  * @param   callable  $openWith  optional  open port with this function
  * @return  \stubbles\peer\Stream
  */
 public function openSecureSocket(int $port, int $timeout = 5, callable $openWith = null) : Stream
 {
     $socket = new Socket($this->ip, $port, 'ssl://');
     if (null !== $openWith) {
         $socket->openWith($openWith);
     }
     return $socket->connect()->setTimeout($timeout);
 }