ENOENT when creating a UNIX socket in Ruby

I am trying to create a socket in Ruby using

require "socket" w = UNIXSocket.new("socket") 

and I continue to work in

 No such file or directory - socket (Errno::ENOENT) 

This looks completely back to me because new() should create this missing file. What am I missing?

+6
ruby unix sockets
source share
1 answer

This is super old. Please do not try to use it verbatim.

http://blog.antarestrader.com/posts/153

 #!/ruby file = 'path/to/my/socket' File.unlink if File.exists(file) && File.socket?(file) server = UNIXServer.new(file) # return a UNIXSocket once a connection is made socket = server.accept # socket is now ready to communicate. 

UnixServer makes a socket, UnixSocket only connects to an existing socket.

+5
source share

All Articles