diff --git a/tcpserver.php b/tcpserver.php index b332d48..af55204 100644 --- a/tcpserver.php +++ b/tcpserver.php @@ -225,7 +225,13 @@ class tcpserver if ($this->socket === null) throw new \Exception ("Can not send to server $this->ipOrName : ". "The server is not connected", 500); + // Setting the options allow the IP to be decided by the connect and valid + // the certificate of the server by the name + $options = array ("ssl" => array ( + "verify_peer_name" => false, + )); stream_set_blocking ($this->socket, true); + stream_context_set_option ($this->socket, $options); return stream_socket_enable_crypto ($this->socket, !!$val, $cryptoMethod); }