Sha256: c2b63b1473dc1f5050d92f8bd70a5940cdcb02db46ac489b86dd1e9ba6dc4083

Contents?: true

Size: 265 Bytes

Versions: 11

Compression:

Stored size: 265 Bytes

Contents

#!/usr/bin/env ruby

require 'async'
require 'async/io'

endpoint = Async::IO::Endpoint.udp("localhost", 5678)

Async do |task|
	endpoint.bind do |socket|
		while true
			data, address = socket.recvfrom(1024)
			socket.send(data.reverse, 0, address)
		end
	end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
async-io-1.27.2 examples/udp/server.rb
async-io-1.27.1 examples/udp/server.rb
async-io-1.27.0 examples/udp/server.rb
async-io-1.26.0 examples/udp/server.rb
async-io-1.25.0 examples/udp/server.rb
async-io-1.24.0 examples/udp/server.rb
async-io-1.23.3 examples/udp/server.rb
async-io-1.23.1 examples/udp/server.rb
async-io-1.23.0 examples/udp/server.rb
async-io-1.22.0 examples/udp/server.rb
async-io-1.21.0 examples/udp/server.rb