IPC::Client has a server_fd property.
This commit is contained in:
parent
2505ec1c4a
commit
90e98c328a
@ -1,14 +1,20 @@
|
|||||||
|
|
||||||
class IPC::Client < IPC::Context
|
class IPC::Client < IPC::Context
|
||||||
|
property server_fd : Int32
|
||||||
|
|
||||||
# By default, this is a client.
|
# By default, this is a client.
|
||||||
def initialize(service_name : String)
|
def initialize(service_name : String)
|
||||||
super()
|
super()
|
||||||
r = LibIPC.ipc_connection(self.pointer, service_name)
|
serverfd = 0
|
||||||
|
|
||||||
|
r = LibIPC.ipc_connection(self.pointer, service_name, pointerof(serverfd))
|
||||||
if r.error_code != 0
|
if r.error_code != 0
|
||||||
m = String.new r.error_message.to_slice
|
m = String.new r.error_message.to_slice
|
||||||
raise Exception.new "error during connection establishment: #{m}"
|
raise Exception.new "error during connection establishment: #{m}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@server_fd = server_fd
|
||||||
|
|
||||||
# Very important as there are filesystem side-effects.
|
# Very important as there are filesystem side-effects.
|
||||||
at_exit { close }
|
at_exit { close }
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user