• Post Reply Bookmark Topic Watch Topic
  • New Topic

Client/server - message getting delayed..  RSS feed

gupta boddu
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing a strange problem.
I have implemented a Client/Server app with client in C and server in Java. Server is a multithreaded app using JDBC (having DB Connection pools).
Sometimes when the client sends the message, server doesn't receive in the first attempt. After many retries it receives. Client side there is not delay.
This is happening very rarely though. I have set all tcp socket properties (TCPNODELAY, SocketTimeout etc).
Here is the piece of code on server which reads the message.
// in - socket inputstream
try {
int len = in.available();
if (debug1)
System.out.println("Available bytes: " + len);
int retries = 0;
while ((len <= 0) && (retries++ < 35))
try {
} catch (Exception e) {}
len = in.available();
if (debug0)
System.out.println("Reading again: "+retries+" "+len);
byte [] b = new byte[BUF_SIZE];
// read all bytes
nread = in.read(b);
bin.write(b, 0, nread);
b = null;
catch (Exception e) {}
Sometimes it reads after 22 retries (that is more than 2 secs). I am running this application on Solaris 2.5
When I do netstat -a on client side, I see the Send-Q is having the message.
If the message is written on client side why it takes so much time on server side??
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!