delay for recv


I am a java programmer and new to Windows socket programming.

I am sending a request to server after setting DSCP value to 0x25 and reading the response using recv()
function in WinSock2. I have a requirement that the recv must be
completed within 200 milliseconds. But the recv is getting delayed by around
600ms even if data is available in the first few milliseconds itself.

I tried the same request in Java and it is getting the response
within 10 or 12 milliseconds. So it is evident that this is not a server side delay.
But I need to implement the tool in C++ for windows and am struggling with this problem for a few weeks.

I tried setting the socket options TCP_NODELAY and SOC_RCVTIMEO socket options. But it did not work.
I also tried with non blocking sockets . But in this case, the select
returns 0 for the first 400 milliseconds and only after that some data
is available. Am I doing anything wrong here? What could be causing the
unnecessary delay in recv()? Is there any other function which
is faster than recv()?
Topic archived. No new replies allowed.