README.md in async-0.11.0 vs README.md in async-0.11.1
- old
+ new
@@ -46,45 +46,45 @@
require 'async'
require 'async/tcp_socket'
def echo_server
- Async::Reactor.run do |task|
- # This is a synchronous block within the current task:
- task.with(TCPServer.new('localhost', 9000)) do |server|
-
- # This is an asynchronous block within the current reactor:
- task.reactor.with(server.accept) do |client|
- data = client.read(512)
-
- task.sleep(rand)
-
- client.write(data)
- end while true
- end
- end
+ Async::Reactor.run do |task|
+ # This is a synchronous block within the current task:
+ task.with(TCPServer.new('localhost', 9000)) do |server|
+
+ # This is an asynchronous block within the current reactor:
+ task.reactor.with(server.accept) do |client|
+ data = client.read(512)
+
+ task.sleep(rand)
+
+ client.write(data)
+ end while true
+ end
+ end
end
def echo_client(data)
- Async::Reactor.run do |task|
- Async::TCPServer.connect('localhost', 9000) do |socket|
- socket.write(data)
- puts "echo_client: #{socket.read(512)}"
- end
- end
+ Async::Reactor.run do |task|
+ Async::TCPServer.connect('localhost', 9000) do |socket|
+ socket.write(data)
+ puts "echo_client: #{socket.read(512)}"
+ end
+ end
end
Async::Reactor.run do
- # Start the echo server:
- server = echo_server
-
- 5.times.collect do |i|
- echo_client("Hello World #{i}")
- end.each(&:wait) # Wait until all clients are finished.
-
- # Terminate the server and all tasks created within it's async scope:
- server.stop
+ # Start the echo server:
+ server = echo_server
+
+ 5.times.collect do |i|
+ echo_client("Hello World #{i}")
+ end.each(&:wait) # Wait until all clients are finished.
+
+ # Terminate the server and all tasks created within it's async scope:
+ server.stop
end
```
## Supported Ruby Versions
@@ -120,10 +120,10 @@
5. Create new Pull Request
## See Also
- [async-dns](https://github.com/socketry/async-dns) — Asynchronous DNS resolver and server.
-- [rubydns](https://github.com/socketry/rubydns) — A easy to use Ruby DNS server.
+- [rubydns](https://github.com/ioquatix/rubydns) — A easy to use Ruby DNS server.
## License
Released under the MIT license.