I have the following basic code. When I run this it says "TCPServer
Error: Address already in use - bind(2)". I can hit Ctrl-C to kill it,
change the port to anything and rerun it and I still get that error
message. I must be missing something really basic.

require 'webrick'
include WEBrick

class AddServlet < HTTPServlet::AbstractServlet
  def do_GET(req, res)
    n1 = req.query['n1'].to_i
    n2 = req.query['n2'].to_i

    res['Content-Type'] = 'text/html'
    res.body = "The sum of #{n1} and #{n2} is #{n1 + n2}."
  end
end

server = HTTPServer.new(:Port=>2000)
trap('INT') { server.shutdown }
trap('TERM') { server.shutdown }
server.mount("/add", AddServlet)
server.start

--
R. Mark Volkmann
Partner, Object Computing, Inc.