Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

Java Stream Write Exception

Ads

 
 

Share on Google+Share on Google+

Md Yusuf Ali
Java Stream Write Exception
0 Answer(s)      4 years and 10 months ago
Posted in : Java Beginners

I am doing socket programming. I have two files called Server.java and client.java. Both programs were running successfully and successfully sending data to each other. Yesterday I added the following lines to client.java file:

 //old line
 out.writeUTF(dbdata); //dbdata was written successfully and sent to the server program
 try
 {
      //my socket connection object name is sock
        String data1="1000";
        System.out.println(data1);
        out.writeUTF(data1);   this line causes the error
 }

 catch(Exception e)
 {
        System.out.println("Exception :: "+e);
 }

When the line out.writeUTF(data1) is executed and catch catches it and shows the exception as BROKEN PIPE.

The contents of server.java which reads data1 is given below:

 String data1;
 try
 {
        data1=in.readUTF();
 }
 catch(Exception e)
 {
        System.out.println("Server Exception :: "+e);
 }

I also checked if connection is open with isConnected() before out.writeUTF(data1) and after the exception occurs in the catch I executed isConnected(). Both the times it showed True only.

The exception that pops up is ----- java.net.SocketException: Broken pipe

Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
Java Stream Write Exception
Java Stream Write Exception  I am doing socket programming. I have...(Exception e) { System.out.println("Exception :: "+e); } When the line out.writeUTF(data1) is executed and catch catches it and shows the exception
Java write to stream
Java write to stream       Following example demonstrates, how to write data in to the stream... is flowed.             write_to_stream .java
Advertisements
Java Stream
Java Stream   What is Stream and Types
How to write a file in Java?
How to write a file in Java? To write a file in Java use the class FileWriter... and strings. Example of how to write text to a file in java: import java.io.... the output stream out.close(); }catch (Exception e){//Catch exception if any
Java I/O stream
Java I/O stream  What class allows you to read objects directly from a stream
Exception Java
Exception Java  Hi, What are the Exception Java? Thanks   Hi, Read it at Java Exception. Thanks
Java Write To File From String
Java Write To File From String In this tutorial you will learn how to write to file from string. Write to file from string using java at first we will have...) to the FileWriter instance to write the character-stream. You can also passed
Java exception
Java exception  What happens if an exception is not caught
Java exception
Java exception  Can an exception be rethrown
Java Exception
Java Exception  Which is superclass of Exception
java exception
java exception   define an exception called no match exception tat z... { public static void main(String[] args) throws Exception { String z="Hello"; if(!z.equals("India")){ throw new Exception
Java exception
Java exception  What is the difference between Checked and Unchecked exception
Java exception
Java exception  What is the difference between exception and error
Java Exception
Java Exception  If I write System.exit (0); at the end of the try block, will the finally block still execute
exception in java - Java Beginners
exception in java  exception in java
How to Write to file in Java?
How to Write to file in Java?  How to Write to file in Java Program... section so that we to write into a character-output stream. You can Visit this link... the Examples of How to write to File in Java Program: WriteToFileExample.java import
Java Exception
Java Exception  Explain about checked and unchecked Exceptions... this exception will be caught by a well-written application and will also prompt... to the constructor. Well in this case the exception could be caught by the application
Java error stream
Java error stream       The Java error stream is used to print error that arises during... to the different stream that allows the user to move them to different pages
Java Exception
Java Exception  What are monitors
Java Exception
Java Exception  What are Chained Exceptions
Java exception
Java exception  What is NullPointerException and how to handle
Java exception
Java exception  Can try statements be nested
Java Exception
Java Exception  What is the purpose of finalization
Java Exception
Java Exception  Why Runtime Exceptions are Not Checked
Java Exception
Java Exception  What is ?Resource leak
Java Exception
Java Exception  Why Errors are Not Checked
stream length not specified - Java Beginners
stream length not specified  our requirement is we need to send the audio data that is spoken by the client to the server and save it in a file. when we r using servlet applet technology we r getting stream length not specified
Java Exception
Java Exception  Can a catch block exist without a try block
exception in java
exception in java  StringIndexOutOfBounds Exception in flames program   Hi Friend, We have providing you a program. Try it: import java.util.*; public class FlamesProgram{ static String name1 = ""; static
if my database(oracle) connection failure means wat is the code to write in exception ?
if my database(oracle) connection failure means wat is the code to write in exception ?  if my database(oracle) connection failure means wat is the code to write in exception
How to Write to a File in Java
In this Java tutorial, we will demonstrate how to write to a file in Java... to a file from Java program. To write the Java Write To File we will use two... is a class used to write text to a character-output stream, buffering characters