Home Answers Viewqa Java-Beginners Java Stream Write Exception

 
 


Md Yusuf Ali
Java Stream Write Exception
0 Answer(s)      8 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

View Answers









Related Pages:
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
Data input & output Stream
write primitive Java data types to an output stream in a portable way... stream lets an application read primitive Java data types from an underlying input...Data input & output Stream  Explain Data Input Stream and Data Output
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
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
Serializable Exception
; When you Write an obj Object to the ObjectOutputstream stream  ... been terminated by End of File Understand Java Exception in Serialization...:\saurabh>java Student Exception in thread "main" java.lang.NoSuchMethodError
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 I/O stream
Java I/O stream  What class allows you to read objects directly from a stream
Java Exception
Java Exception  If I write System.exit (0); at the end of the try block, will the finally block still execute
I/O stream class.
I/O stream class.  Explain the hierarchy of Java I/O stream class.   Hierarchy of Java I/O streams Have a look at the following link: Java I/O
Java Write to File
Java Write to File In this tutorial you will learn how to write to file in java. Write to a file in java we are required to use some classes of java.io... the characters in a buffer to write into a character-output stream. Buffering feature
Java Write To File Binary
Java Write To File Binary In this tutorial you will learn how to write... types can be formed to a byte of 8 bits. Write to a binary file in java... process to execute a java program write simply on command prompt as : javac
Java Write To File By Line
Java Write To File By Line In this tutorial you will learn how to write to file by line Write to a file by line using java you can use the newLine() method... a FileWriter constructor and wrapped the file object to it to write a stream
Exception Handling
will see that how the exception handling can be done in java program. This example... exceptions. This is known as catching exception in Java. The exceptions that occur... in Java. Different kinds of sources and destinations are represented by a Stream
exception
exception  chek in and check out exception in java   Please visit the following link: Checked and Unchecked Exception
Java Write To File BufferedWriter
Java Write To File BufferedWriter In this tutorial you will learn how to write.... This class is used to write texts to a character-output stream. This class stores the characters in a buffer to write into a character-output stream
Exception
Exception  whis is the Arithmetic Exception in java? or define Arithmetic Exception with exp?   Arithmetic Exception occurs, when you divide a number by zero. Example public class TryCatch { public static void main
exception
;Please visit the following links: http://www.roseindia.net/java/java-exception/user-defined-exception.shtml http://www.roseindia.net/java/exceptions/making
exception Handling
exception Handling  write a program in Java to display the names and roll numbrs of students. Initialize respective array variables for 10 students. Handle ArrayIndexOutOfBoundsException, so that any such problem doesn't cause
Exception
Exception  1.Create a class Errorhandle3. Write code that demonstrates how handle and declare rules are different for runtime exceptions and checked exceptions
Object Output Stream
Object Output Stream  Can anyone decode the data from a file which is written by ObjectOutputStream?? I want to know if this is a secure way to write protected data without encryption
Java Write To File Double
Java Write To File Double In this tutorial you will learn how to write to file... to its instance to write the character-stream further passed this object... process to execute a java program write simply on command prompt as : javac
exception
exception  1.Create a class Errorhandle1. `Write code that deliberately throws the following exceptions, without using the â??throwâ?? keyword : ClassCastException NullPointerException ArrayIndexOutOfBoundsException
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
Exception
Exception  what is NullPointerException?   Hi, I java... package. The NullPointerException is thrown by the Java program at the time... in Java program: * If you are calling some method on the null object
Write to a file
Write to a file   ...; the BufferedOutputStream class that store the data in an internal buffer and lets you write characters to a stream. Lets see an example that writes the text "Hello Java"
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
Read Write
Read Write  Hi; How can I read certain line of say 10 text files and write to one text file   Java Read Multiple Files and store the data... static void main(String[]args) throws Exception{ BufferedWriter bw=new
Java write even numbers to file
Java write even numbers to file In this section, you will learn how to write the even numbers to file. By using the PrintWriter class, you can write any type... it to a File, an Output Stream, or a Writer. In the given example, we have
userdefined exception - Java Beginners
userdefined exception  Write a simple program to create user defined exception?  hi import java.io.*;import java.io.IOException;import.../java/example/java/io
Java Exception - Exception Handling in Java
Java Exception - Exception Handling in Java       Exception, that means exceptional errors... code you will see that how the exception handling can be done in java program
Java Write To File End Of Line
Java Write To File End Of Line In this tutorial you will learn how to write to file at the end of the line. Write to a file in which some contents are available already and you need to write the text at the end of line you may to use
Stream Result example
Stream Result example Stream Result is very important for allowing users... of the input stream property. contentLength - It is the Stream length in byte...;. contentDisposition - It is used for specifying file name. An Example of Stream
Write Text To File In New Line.
a FileWriter constructor and wrapped the file object to it to write a stream...Write Text To File In New Line. In this tutorial you will learn how to write... to finish the line and want to write the other text in a new line
java byte stream array - Java Beginners
java byte stream array  I have a byte array that contains hexadecimal data for eg byte[] testMessage = {0x02, // STX 0x31,0x32,0x10,0x02,0x33, // Data 31 32 02 33
How to Write To File BufferedWriter in Java
How to Write To File BufferedWriter in Java  how to write to file bufferedwriter in Java   In Java there are 2 types of class files used... are discussion about bufferedwriter class which is used in character-output stream
How to write into CSV file in Java
passed the file name to write into a stream characters. Then we use the FileWriter...How to write into CSV file in Java  How to write into CSV file in Java   Hi, To create Comma separated value(CSV) file is very simple
How to write file by line in Java
How to write file by line in Java  How to write file by line in Java   Hi, For Write to a file by line using java programming language we... in a new line. How to use Write To File By Line in Java programs
how to write append file in Java
how to write append file in Java  How to write append file in Java... to FileWriter constructor to write a stream of characters. The Constructor... existing file should be retained when you are trying to write new contents
Exception Handling in Java
on the following links Exception Handling in Java Example to show exception handling in java User Defined Exception List of Java Exception Unhandled Exception Show ArrayoutofboundException in java Show Hash table exception
Java file read write operation
Java file read write operation  how to read and write the data from..."); oos.writeInt(8000); oos.writeObject("Ankit"); oos.writeObject("Java...(); System.out.println("objects written to the stream successfully"); code for reading
Out Of Memory Exception Erorr
Out Of Memory Exception Erorr  hello how are you?I hope you are fine I'm using jgrasp program my problem is in java programming my program compiled with no problem but when I run it this exception appears: Exception
Exception Java
Exception Java  Hi, What are the Exception Java? Thanks   Hi, Read it at Java Exception. Thanks
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 Write To File - Java Tutorial
Java Write To File - Java Tutorial Learn how to write to a file from... on a FileOutputStream classes to write data to a file from Java program... of Java Tutorial you will learn how to write java program to write to a file. We
write following program
-threading. Explain with examples Q2 Write a java applet that takes your name... the state transition diagram of a thread Q6 Write a java applet that displays 9... Explain exception handling features of java with suitable examples? Q12 What
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.