I have written a small port scnaner in Java. But I want to add some more functionality to it. Can anyone help me incorporate the following in my program:

1. List out the service that is listening on a particular port.
2. Close an open port (>1024, of course)

Help with example code would be very welcome.