Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.net.SocketException: Connection reset

567558May 14 2007 — edited May 14 2007
why when i close a client i get java.net.SocketException:

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at zad41.ServerThread.run(ServerThread.java)
public void communicate(){
    	System.out.println("Communication starts!");
     
        String fromServer="Receiving data form server";
    	 try {
			while ((fromServer = in.readLine()) != null) {
			     System.out.println("Server: " + fromServer);
			     output.setText(fromServer);
			     if (fromServer.equals("Bye."))
			         break;
			  
			if (action != null) {
			         System.out.println("Client: " + action);


			       
			         
			         
			         if(lastname!=null){
			         	out.println(action+":"+lastname);
			         	out.flush();
			         }
			         
			        
			         
			         if(number_with!=null){
			        	 String info[]=number_with.split(" ");
			         	out.println(action+":"+info[0]+":"+info[1]);
			         	out.flush();
	                   }
			           }
			 }
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
    
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 11 2007
Added on May 14 2007
1 comment
296 views