title: close a socket port on linux
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/767292/how-do-i-close-a-port-in-a-case-of-program-termination">How do I close a port in a case of program termination?</a>  </p>
  </blockquote>
  
  
  
  <p>I am running my program on a linux machine with no user interface. 
  It's written in Java. I have a <code>ServerSocket</code> listening at a certain port. A client socket will send an exit command to the server, and then the program stops. But after tje client sends the exit message, the server port does not seem to close. When I try to start my program again I get a <code>java.net.BindException: Address already in use</code>.</p>
  
  <p>How can I close this port now? Can someone please recommend some linux commands or tools to monitor the port status?</p>
  
  <p>Thank you.</p>