Supported Versions: PHP 5 >= 5.1.0, PHP 7, PHP 8
Converts a human readable IP address to its packed in_addr representation
<?php inet_pton(string $ip): string|false
<?php         $connector = $this->connector;




        if (@\inet_pton($host) !== false) {

            return $connector->connect($original);

        }
<?php         $host = \trim($parts['host'], '[]');




        if (@\inet_pton($host) !== false) {

            return $this->connector->connect($original);

        }
<?php         }



        $ip = \trim($parts['host'], '[]');

        if (@\inet_pton($ip) === false) {

            return Promise\reject(new \InvalidArgumentException(

                'Given URI "' . $uri . '" does not contain a valid host IP (EINVAL)',

                \defined('SOCKET_EINVAL') ? \SOCKET_EINVAL : 22
<?php             );

        }



        if (@\inet_pton(\trim($parts['host'], '[]')) === false) {

            throw new \InvalidArgumentException(

                'Given URI "' . $uri . '" does not contain a valid host IP (EINVAL)',

                \defined('SOCKET_EINVAL') ? \SOCKET_EINVAL : 22
<?php         $ip = Block\await($this->request('dual.tlund.se', $connector), null, self::TIMEOUT);



        $this->assertNotFalse(inet_pton($ip));

    }
<?php             throw $e;

        }



        $this->assertNotFalse(inet_pton($ip));

        $this->assertEquals(4, strlen(inet_pton($ip)));

    }
<?php         }



        $this->assertNotFalse(inet_pton($ip));

        $this->assertEquals(4, strlen(inet_pton($ip)));

    }
<?php             throw $e;

        }



        $this->assertNotFalse(inet_pton($ip));

        $this->assertEquals(16, strlen(inet_pton($ip)));

    }
<?php         }



        $this->assertNotFalse(inet_pton($ip));

        $this->assertEquals(16, strlen(inet_pton($ip)));

    }



    public function testCancelPendingTlsConnectionDuringTlsHandshakeShouldCloseTcpConnectionToServer()