Hi,

I have a problem with my java ServerSocket. At first I created a ServerSocket at port 
34567. I run the program, it works fine. Then I stopped the server, and edit and 
recompile the program. If I run it again, I got the following IOException error 
message:" Adddress already in use". So I have to change port number each time I want 
to modify my code. But if I run my code on window, I didn't get any problem. I append 
my code below. Can anybody help me ? 

Thanks in advance.

Zhihong Pan
Chek, Inc


public class MyServer {

    public static void main(String[] args) throws IOException {

        ServerSocket serverSocket = null;
        boolean listening = true;

        try {
            serverSocket = new ServerSocket(34567);
        } catch (IOException e) {
            System.out.println(e.getMessage());
            System.exit(-1);
        }

        while (listening)
             new MyServerThread(serverSocket.accept()).start();

        serverSocket.close();
    }
}



----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to