Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Java Stream Write Exception

Have Programming Question? Ask it here!
 
 
 


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


Advertisement
View Answers

Related Tutorials/Questions & Answers:
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
Java Stream
Java Stream   What is Stream and Types
Advertisements
Java I/O stream
Java I/O stream  What class allows you to read objects directly from a stream
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 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 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 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
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
Java Exception
Java Exception  What are monitors
exception in java - Java Beginners
exception in java  exception in java
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
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
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
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"
write a java program
write a java program  write a program to print '*' in a circular form
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 exception handling
Java exception handling  what are the constraints imposed by overriding on exception handling
How to write Java Program
How to write Java Program  how to write a program to find average of 5 student marks
null pointer exception in java
null 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
java exception handle
java exception handle  How error can be handled in the exception class?? can we handle fatal error in java
Java Exception - Java Beginners
Java Exception  Why we are using throws in the java program even if we have try...catch block? If throws will throw the exception then who will catch... links: http://www.roseindia.net/java/exceptions/how-to-throw-exceptions.shtml
exception in java - Java Beginners
exception in java  exception in java  Hi Friend, Exceptions are the errors that occur during the execution of the program. Exceptions...: http://www.roseindia.net/java/exceptions/ Thanks
Java exception handling
Java exception handling  How does a try statement determine which catch clause should be used to handle an exception
Exception - Java Beginners
What is Exception in Java  What is the Exception that occurs while running the application in Java
Java exception handling
Java exception handling  How does a try statement determine which catch clause should be used to handle an exception
Java exception handling
Java exception handling  What is the catch or declare rule for method declarations
Java exception handling
Java exception handling  What is the difference between throw and throws keywords
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
Exception - Java Beginners
Chained 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
java Exception - Java Beginners
java Exception  Hello sir ,Here Exception in thread "main" java.lang.NoClassDefFoundError: bitwisedemo1/java Help me /** * Author@sushant savant a=64,I=a<<2 find I using Bitwise Left shift * */ public
Exception Handlerin java..
Exception Handlerin java..  can a catch block accept multiple argument and return type?? please tell with explaination
Java sql Exception
Java sql Exception  difference between sql exception class and sql warning class
Java exception class
Java exception class  What classes of exceptions may be caught by a catch clause
Java exception handling
Java exception handling  Does the order of placing catch statements matter in the catch block
Java exception handling
Java exception handling  What classes of exceptions may be caught by a catch clause
Java exception handling
Java 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
Write a program in java...
Write a program in java...  Hi, friends Please, can you help me? Q1: Write a program in java to simulate a calculator. Your program should take two... to enter an integer number. Write a program in java to find the factorial
Advertisements
 

 

 

DMCA.com