wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes Read operation failed from Socket. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Read operation failed from Socket." Watch "Read operation failed from Socket." New topic
Author

Read operation failed from Socket.

MuraliManohar Chepuri
Greenhorn

Joined: Sep 29, 2010
Posts: 5
Hi,

We had a legacy application built on IBM RAD tech stack which has Socket Server and client ( Client is a third party application)
Server was using BufferedReader and BufferedWriter to read and write data from sockets in IBM-1025 Char set.

Now i am re writing the same server in Java6

As part of application specific protocol....

After the successful connection client should send a time stamp in str format to start the communication.

Here ... the new server is failing to read the data and is on hold for some time @ read statement before Connection times out.
Here i used diff alternates to get this worked.
But could not able to succeed.



And



So thought of asking help to figure out ..

Thanks,
Murali
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

I'm assuming that you're using the method BufferedReader.readLine(). That method reads a line from the buffer. A line is terminated either by a line feed, carriage return or both. So if the client doesn't send a line terminator then the method will block and wait until one is send.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
MuraliManohar Chepuri
Greenhorn

Joined: Sep 29, 2010
Posts: 5
I am not using readLine method...

I am using read method


private String receiveMessage(int pBytesToRead)
throws SocketTimeoutException, IOException
{
String methodName = "String receiveMessage(int pBytesToRead)";
char charArray[] = new char[pBytesToRead];
readStream.read(charArray, START_POS, pBytesToRead);

_logger.logp(Level.FINEST, CLAZZ_NAME, methodName,
"Read : " + new String(charArray));
return new String(charArray);
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Read operation failed from Socket.
 
Similar Threads
client-serer...plz help
IO Streams and sockets
Connection Refused Error
Chatting Applet Problem
Object streams and readers