tags:

views:

197

answers:

1

I am trying to code my program so that the buffered reader gets something in readLine() from my tcp client but I get this error as soon as the program executes

   Mar 31, 2010 11:03:36 PM deswash.DESWashView$5 run
SEVERE: null
java.net.SocketException: Software caused connection abort: recv failed
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.readLine(BufferedReader.java:299)
        at java.io.BufferedReader.readLine(BufferedReader.java:362)
        at deswash.DESWashView$5.run(DESWashView.java:448)

the car=in.readLine() in the following code throws the error

 public void getCar(){
        Thread gettingCars = new Thread(){
            @Override
            public void run(){
                try {
                    car = in.readLine();
                    if(!(car.equals(null))){
                        StringTokenizer st = new StringTokenizer(car,";");
                        int carTime = Integer.parseInt(st.nextToken());
                        finTime.setText(""+((Integer.parseInt(currentTime.getText()))+washTime));
                        currentTime.setText(""+carTime);
                        eventTextArea.append(""+car+"\n");
                    }
                } catch (IOException ex) {
                    Logger.getLogger(DESWashView.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        };
        gettingCars.start();
        doOnce=false;
    }
A: 

See here for the correct explanation.

EJP