libipc-examples/crystal/src/input2ipc.cr

9 lines
204 B
Crystal
Raw Normal View History

# Input to IPC network packets.
buffer = Bytes.new 1_000_000
2023-05-15 09:36:12 +02:00
while true
len = STDIN.read buffer
break if len == 0
2023-05-15 09:36:12 +02:00
STDOUT.write_bytes len, IO::ByteFormat::BigEndian
STDOUT.write buffer[0.. len -1]
end