-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UNIXServer example in docs #5181
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this example. If the first client doesn't send anything then no other client will be able to connect. There should be a spawn
somewhere (same goes for the TCPServer
example)
Agree @asterite require "socket"
def handle_client(client)
message = client.gets
client.puts message
end
server = UNIXServer.new("/tmp/myapp.sock")
while client = server.accept?
spawn handle_client(client)
end More sth like this then? |
@bew I think so, yes :-) |
@petoem Sure! You can fix it in this PR :-) |
The example is essentially the same as the TCPServer one. I verified both UNIXServer and UNIXSocket examples, they work.
/cc @bew