Java Stream Write Exception
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 Tutorials/Questions & Answers:
Java Stream Write ExceptionJava 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... to
write data in to the underlying character
stream. In the example to
write, data
Advertisements
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:ADS_TO_REPLACE_6
import...");
//Close the output
stream
out.close();
}catch (
Exception e){//Catch
Exception JavaException Java Hi,
What are the
Exception Java?
Thanks
Hi,
Read it at
Java Exception.
Thanks
Java Write To File From StringJava 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 exceptionJava exception What happens if an
exception is not caught
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 exceptionJava exception What is the difference between Checked and Unchecked
exception Java exceptionJava exception What is the difference between
exception and error
Java ExceptionJava Exception If I
write System.exit (0); at the end of the try block, will the finally block still execute
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 I/O streamJava I/O stream What class allows you to read objects directly from a
stream Java ExceptionJava 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
exception in javaexception in java StringIndexOutOfBounds
Exception in flames program
Hi Friend,
We have providing you a program. Try it:ADS_TO_REPLACE_1
import java.util.*;
public class FlamesProgram{
static String name1
Java exceptionJava exception What is NullPointerException and how to handle
Java ExceptionJava Exception Can a catch block exist without a try block
Java exception handlingJava exception handling what are the constraints imposed by overriding on
exception handling
Java Write to FileJava 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... stores the characters in a
buffer to
write into a character-output
stream null pointer exception in javanull pointer
exception in java What is null pointer
exception in
Java and when it occurs? Show it with an example.Thanks!
Java Null Pointer
Exception How to Write To File BufferedWriter in JavaHow 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 java exception handlejava exception handle How error can be handled in the
exception class??
can we handle fatal error in
java Java exception handlingJava exception handling How does a try statement determine which catch clause should be used to handle an
exception Java exception handlingJava exception handling How does a try statement determine which catch clause should be used to handle an
exception How to Write to a File in JavaIn 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...
The BufferWriter is a class used to
write text to a character-output
stream,
buffering
How to write file by line in JavaHow 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 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
userdefined exception - Java Beginnersuserdefined exception
Write a simple program to create user defined
exception? hi import java.io.*;import java.io.IOException;import.../
java/example/
java/io
Exception - Java BeginnersChained
Exception in Java What is the Chained
Exception in
Java? Chained
Exception in JavaChained
Exception in
Java, this is a new... of exceptions, and these
exception can be caused by another exception.Exceptions in
Java How to write in File in JavaHow to
write in File in Java Hi,
How to
write in File in
Java. Please suggest and give example of this program.
thanks
how to write append file in Javahow 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
exceptionexception chek in and check out
exception in
java
Please visit the following link:
Checked and Unchecked
Exception check null exception javacheck null
exception java check null
exception java - How to check the null
exception on
Java?
The null pointer
exception in
java occurs... on it.
See the example null pointer
exception Java exception handlingJava exception handling What happens if a try-catch-finally statement does not have a catch clause to handle an
exception that is thrown within the body of the try statement