diff --git a/examples/01-http.php b/examples/01-http.php index be7b1c0..779c31e 100644 --- a/examples/01-http.php +++ b/examples/01-http.php @@ -19,7 +19,7 @@ // time out connection attempt in 3.0s $dns = new TimeoutConnector($dns, 3.0, $loop); -$dns->create('www.google.com', 80)->then(function (ConnectionInterface $connection) { +$dns->connect('www.google.com:80')->then(function (ConnectionInterface $connection) { $connection->on('data', function ($data) { echo $data; }); diff --git a/examples/02-https.php b/examples/02-https.php index d18dce0..9c92a9a 100644 --- a/examples/02-https.php +++ b/examples/02-https.php @@ -21,7 +21,7 @@ // time out connection attempt in 3.0s $tls = new TimeoutConnector($tls, 3.0, $loop); -$tls->create('www.google.com', 443)->then(function (ConnectionInterface $connection) { +$tls->connect('www.google.com:443')->then(function (ConnectionInterface $connection) { $connection->on('data', function ($data) { echo $data; }); diff --git a/examples/03-netcat.php b/examples/03-netcat.php index 5ede41a..e0c633c 100644 --- a/examples/03-netcat.php +++ b/examples/03-netcat.php @@ -8,8 +8,8 @@ require __DIR__ . '/../vendor/autoload.php'; -if (!isset($argv[2])) { - fwrite(STDERR, 'Usage error: required arguments ' . PHP_EOL); +if (!isset($argv[1])) { + fwrite(STDERR, 'Usage error: required argument ' . PHP_EOL); exit(1); } @@ -33,7 +33,7 @@ $stderr->write('Connecting' . PHP_EOL); -$dns->create($argv[1], $argv[2])->then(function (ConnectionInterface $connection) use ($stdin, $stdout, $stderr) { +$dns->connect($argv[1])->then(function (ConnectionInterface $connection) use ($stdin, $stdout, $stderr) { // pipe everything from STDIN into connection $stdin->resume(); $stdin->pipe($connection);