Obsolete
/
ipc.cr-old
Archived
3
0
Fork 0
This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues/pull-requests.
ipc.cr-old/tests/pongc.cr

25 lines
411 B
Crystal
Raw Normal View History

2020-07-14 17:04:51 +02:00
require "../src/ipc.cr"
client = IPC::Client.new "pong"
server_fd = client.server_fd
if server_fd.nil?
puts "there is no server_fd!!"
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