class Protobuf::Rpc::Connectors::Zmq

def ping_port_open?(host)

def ping_port_open?(host)
  socket = TCPSocket.new(host, ping_port.to_i)
  socket.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, 1)
  socket.setsockopt(::Socket::SOL_SOCKET, ::Socket::SO_LINGER, [1, 0].pack('ii'))
  true
rescue
  false
ensure
  begin
    socket && socket.close
  rescue IOError
    nil
  end
end