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/src/ipc/client.cr

44 lines
679 B
Crystal
Raw Normal View History

2019-07-27 15:29:27 +02:00
require "./lowlevel"
require "./message"
require "./event"
require "./service"
require "./connection"
class IPC::Client < IPC::Connections
@connection : IPC::Connection
def initialize(name : String)
super()
@connection = IPC::Connection.new name
self << @connection
end
def initialize(name : String, &block : Proc(IPC::Event::Events|Exception, Nil))
2019-07-27 15:29:27 +02:00
initialize name
::loop &block
close
end
def send(*args)
@connection.send *args
end
def read(*args)
@connection.read *args
end
# sanitizer
def fd
@connection.fd
end
def loop(&block : Proc(IPC::Event::Events|Exception, Nil))
2019-07-27 15:29:27 +02:00
super(nil, &block)
end
def close
@connection.close
end
end