title: Trying to Get a new ServerSocket to open fails
body: <p>I was given the below code by my teacher for a class. I ran it one or twice and it worked fine. However I suddenly cannot get it to run from the command prompt on Windows 8 anymore. No matter what port I specify it just prints "Opening port..." and never continues. No exception is ever thrown. I have disabled my firewall and antivirus and it does not seem to work. I have added a print statement as the first line of the try catch block and it will print but it just will not create the new Socket. I am sure it is something in my Windows settings but I am unsure as to what or how to resolve it.</p>
  
  <pre><code>// Server program
  // File name: "TCPServer.java"
  
  import java.io.*;
  import java.net.*;
  public class TCPServer
  {
       private static ServerSocket servSock;
       public static void main(String[] args)
      {
          System.out.println("Opening port...\n");
          try{
  
         // Create a server object 
                servSock = new ServerSocket(Integer.parseInt(args[0])); 
          }
  
          catch(IOException e){
               System.out.println("Unable to attach to port!");
               System.exit(1);
          }
  
         do 
         {  
              run();
         }while (true);
  
      }
  
      private static void run()
     {
          Socket link = null; 
          try{
  
  
  
          // Put the server into a waiting state
                 link = servSock.accept(); 
  
          // Set up input and output streams for socket
                BufferedReader in = new BufferedReader(new InputStreamReader(link.getInputStream())); 
                PrintWriter out = new PrintWriter(link.getOutputStream(),true);
  
      // print local host name
                String host = InetAddress.getLocalHost().getHostName();
                System.out.println("Client has estabished a connection to " + host);
  
      // Receive and process the incoming data 
               int numMessages = 0;
               String message = in.readLine(); 
               while (!message.equals("DONE"))
               {
                   System.out.println(message);
                   numMessages ++;
                   message = in.readLine();
               }
  
        // Send a report back and close the connection
              out.println("Server received " + numMessages + " messages"); 
        }
  
        catch(IOException e){
            e.printStackTrace();
        }
  
        finally{
             try{
                  System.out.println("!!!!! Closing connection... !!!!!\n" + "!!! Waiting for the next connection... !!!");
                  link.close(); 
             }
  
             catch(IOException e){
                   System.out.println("Unable to disconnect!");
                  System.exit(1);
             }
      }
  
    }
  
  }
  </code></pre>