Results 1 to 5 of 5

Thread: illegal start of type?{resolved}

Threaded View

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Angry illegal start of type?{resolved}

    Any ideas why the compiler keeps pissing about an illegal start of type at while(true){? I compile this class under the command line system compiler and using Eclipse and i keep getting the same results.
    Code:
    import java.io.*;
    import java.net.*; 
    
    class Server{
     private ServerSocket ser;   
     private Socket soc;
     private OutputStreamWriter out;
     private int port; 
     
     public Server(int port){
         this.port = port; 
      try{
         ser = new ServerSocket(port);
      }catch(IOException e){
         System.out.println("Port" + ser.getLocalPort() + "is occupied"); 
       }
     }
    
    while(true){
     try{
      soc = ser.accept();
      out = new OutputStreamWriter(soc.getOutputStream()); 
      out.write("port open \r\n");
      soc.close();
      }catch(IOException e){
        /*
        transitory exception\client broke the connection early
      */
       } 
      }
     }
    Last edited by Dilenger4; Nov 25th, 2003 at 01:24 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width