def serve_service
      raise 'Service was already started' unless stopped?

      # set flag to signal shutdown by stop / shutdown command
      @shutdown = false

      # instantiate the service for alls @hosts and @ports
      @hosts.each_with_index do |host, index|
        # instantiate the service for each host and port
        # if host is empty "" wildcard (all) interfaces are used
        # otherwise it will be bind to single host ip only
        # if ports at index is not specified, use last item
        # of ports array. if multiple ports specified by
        # item like 2525:3535:4545, then all are instantiated
        ports_for_host = (index < @ports.length ? @ports[index] : @ports.last).to_s.split(':')
        # loop all ports for that host
        ports_for_host.each do |port|
          serve_service_on_host_and_port(host, port)
        end
      end
    end
def serve_service
      raise 'Service was already started' unless stopped?

      # set flag to signal shutdown by stop / shutdown command
      @shutdown = false

      # instantiate the service for alls @hosts and @ports
      @hosts.each_with_index do |host, index|
        # instantiate the service for each host and port
        # if host is empty "" wildcard (all) interfaces are used
        # otherwise it will be bind to single host ip only
        # if ports at index is not specified, use last item
        # of ports array. if multiple ports specified by
        # item like 2525:3535:4545, then all are instantiated
        ports_for_host = (index < @ports.length ? @ports[index] : @ports.last).to_s.split(':')
        # loop all ports for that host
        ports_for_host.each do |port|
          serve_service_on_host_and_port(host, port)
        end
      end
    end
Start the listeners for all hosts