Sha256: 2625d80a979a6ddac9a1baccbc7ad83036cbf1051657d19917add0b08d4cd5cf

Contents?: true

Size: 295 Bytes

Versions: 7

Compression:

Stored size: 295 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

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

7 entries across 7 versions & 1 rubygems

Version Path
async-io-1.29.0 examples/udp/server.rb
async-io-1.28.0 examples/udp/server.rb
async-io-1.27.7 examples/udp/server.rb
async-io-1.27.6 examples/udp/server.rb
async-io-1.27.5 examples/udp/server.rb
async-io-1.27.4 examples/udp/server.rb
async-io-1.27.3 examples/udp/server.rb