Skip to content

Commit 1ea1569

Browse files
committed
Fix examples by replacing references to new Socket
1 parent bb3073d commit 1ea1569

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

example/client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
$factory = new Datagram\Factory($loop, $resolver);
1111

12-
$factory->createClient('localhost', 1234)->then(function (Datagram\Client $client) use ($loop) {
12+
$factory->createClient('localhost', 1234)->then(function (Datagram\Socket $client) use ($loop) {
1313
$client->send('first');
1414

1515
$client->on('message', function($message, $server) {
1616
//$remote->send() is same as $client->send()
1717

18-
echo 'received "' . $message . '" from ' . $server->getAddress() . PHP_EOL;
18+
echo 'received "' . $message . '" from ' . $server. PHP_EOL;
1919
});
2020

2121
$client->on('error', function($error, $server) {

example/server.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
$factory = new Datagram\Factory($loop);
88

9-
$factory->createServer(1234)->then(function (Datagram\Server $server) {
10-
$server->on('message', function($message, $client) {
11-
$client->send('hello '.$client->getAddress().'! echo: '.$message);
9+
$factory->createServer(1234)->then(function (Datagram\Socket $server) {
10+
$server->on('message', function($message, $address) use ($server) {
11+
$server->send('hello ' . $address . '! echo: ' . $message, $address);
1212

13-
echo 'client ' . $client->getAddress() . ': ' . $message . PHP_EOL;
13+
echo 'client ' . $address . ': ' . $message . PHP_EOL;
1414
});
1515
});
1616

0 commit comments

Comments
 (0)