I am Developing an Client Server socket application .Am reading Strings in server side for multiple clients inside run(override) method and I getting EOF Exception at readUTF. I Dont know why the error is comming and how to rectify it.

while (ss.compareTo("true") == 0) {
        System.out.println("Waiting for port " + port);
        sdc = soc.accept();

        cs[i] = sdc;
        System.out.println("Connected port " + cs[i]);

        DataInputStream dind = new DataInputStream(cs[i].getInputStream());
        DataOutputStream dout = new DataOutputStream(cs[i].getOutputStream());

        String password = dind.readUTF();
        String dept = dind.readUTF();
        uniqueName = dind.readUTF();
        String username = dind.readUTF();
        String ipaddress = dind.readUTF();
        String macaddress = dind.readUTF();
        String groupname = dind.readUTF();
    }

Show the code that's writing that info.

IE, please show what is setting the 'ss' variable that you are checking. The loop you show doesn't explicitly set it. That said, unless ss is a global variable, this could result in an endless loop.

@rubberman : ss is a String variable assigned as true and it is an endless while loop to accept all connection

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.