I'm trying to use UnixSocket in my Ruby scripts in Order to let multiple processes communicate with each other.
But i don't understand why i i can send only one message to the listening process. Stipped to the basics i have:
Server
require 'socket'
server = UNIXServer.open('/tmp/scanlcd_test.sock')
while true do
client = server.accept
puts "I got: " + client.readline
end
server.close
Client:
require 'socket'
client = UNIXSocket.open('/tmp/scanlcd_test.sock')
client.puts "1"
sleep 9
client.puts "2"
client.puts "3"
client.puts "4"
The result is:
./server.rb
I got: 1
Thats it ... the last 3 puts are gone ... Whats wrong there?