Hello! I have an issue:
The same code for a tcp endpoint works as expected - server listens forever, for UnixServer - server exited after a first received message from a client.
server.rb
require "async/io"
require 'async/io/unix_socket'
require 'fileutils'
FileUtils.rm_f "./tmp.sock"
#@server = Async::IO::Endpoint.tcp('127.0.0.1', 1234)
@server = Async::IO::UNIXServer.wrap("./tmp.sock")
Async do |task|
@server.accept do |client|
a = client.read(6)
client.send "elloh\n"
client.close_write
end
end
client.rb
require "socket"
# 10.times do
# TCPSocket.open("127.0.0.1", 1234) do |socket|
# socket << "hello\n"
# p socket.read(6)
# socket.close
# end
# end
10.times do
UNIXSocket.open("./tmp.sock") do |socket|
socket << "hello\n"
p socket.read(6)
socket.close
end
end
Hello! I have an issue: The same code for a tcp endpoint works as expected - server listens forever, for UnixServer - server exited after a first received message from a client.
server.rb
client.rb
ruby 3.2.0