43        $socket = @socket_create($ipv6 ? AF_INET6 : AF_INET, SOCK_DGRAM, SOL_UDP);
 
   44        if($socket === 
false){
 
   45            throw new \RuntimeException(
"Failed to create socket: " . trim(socket_strerror(socket_last_error())));
 
   47        $this->socket = $socket;
 
   50            socket_set_option($this->socket, IPPROTO_IPV6, IPV6_V6ONLY, 1);