#!/usr/bin/env ruby
if ARGV.size != 1
STDERR.puts("Arguments: <filename>")
exit(1)
end
require "socket"
UNIXSocket.open(ARGV[0]) do |socket|
while input = STDIN.gets
socket.write(input)
socket.flush
output = socket.gets
STDOUT.write(output)
end
end
Please note that this script operates on a line by line basis.
netcat
nc -U filename
socat
socat - UNIX-CONNECT:filename