This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues/pull-requests.
2020-07-14 16:46:44 +02:00
|
|
|
require "../src/ipc.cr"
|
|
|
|
|
|
|
|
client = IPC::Client.new "pong"
|
|
|
|
|
|
|
|
server_fd = client.server_fd
|
|
|
|
|
|
|
|
if server_fd.nil?
|
2020-07-14 17:02:14 +02:00
|
|
|
puts "there is no server_fd!!"
|
2020-07-14 16:46:44 +02:00
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
|
|
|
message = IPC::Message.new server_fd, 1, 42.to_u8, "salut ça va ?"
|
|
|
|
|
|
|
|
client.send message
|
|
|
|
|
|
|
|
client.loop do |event|
|
|
|
|
case event
|
|
|
|
when IPC::Event::MessageReceived
|
|
|
|
puts "\033[32mthere is a message\033[00m"
|
|
|
|
puts event.message.to_s
|
|
|
|
client.close
|
|
|
|
exit
|
|
|
|
end
|
|
|
|
end
|