How do I implement a web application with a Servlet that is listening on a port for socket connections?
Not totally sure what you want to achieve, but you can have a look at client/server programming if that's what you need. Other than that, you could implement your web application as normal but change the default port to whatever suits your need.