Module: Dhun::Client

Included in:
Runner
Defined in:
lib/dhun/client.rb

Instance Method Summary collapse

Instance Method Details

#is_server?(socket) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
# File 'lib/dhun/client.rb', line 15

def is_server?(socket)
  begin
    UNIXSocket.open(socket) { |socket| }
    return true
  rescue StandardError
    return false
  end
end

#send_message(message, socket) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/dhun/client.rb', line 6

def send_message(message,socket)
  response = nil
  UNIXSocket.open(socket) do |unix|
    unix.puts message
    response = unix.read
  end
  response
end