0

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();
    }

Edited by sankubha: Forget to enter code

3
Contributors
3
Replies
14
Views
2 Years
Discussion Span
Last Post by sankubha
0

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.

0

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

Edited by sankubha

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.