I'm trying to create a socket in Ruby using
require "socket"
w = UNIXSocket.new("socket")
and I keep running into
No such file or directory - socket (Errno::ENOENT)
This looks completely backwards to me, because new()
is supposed to create that missing file. What am I missing?
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 the socket, UnixSocket only connects to an existing socket.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With