Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read operation failed from Socket.

 
MuraliManohar Chepuri
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
MuraliManohar Chepuri
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic