From 8d6921f287c22606e80a1ea7f28f9bc117c8af3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Wed, 8 Mar 2017 16:14:26 +0100 Subject: [PATCH] Fix examples to use updated API --- examples/01-http.php | 2 +- examples/02-https.php | 2 +- examples/03-netcat.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) 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);