Socket problems

Hello everyone,

I’m having a litle problem with sockets on QNX RTP 6.1

I have made two very simple programs, a server and a client. The server is
supposed to listen on a socket and reply the amount of data requested by a
client (the actual data is irrelevant). The client is supposed to send 4
bytes to the server (a long value) with the amount of data requested from
the server, and wait for the server so send that amount of data back.

The problem araises when the client askes an amount between 101 and 208
bytes or over 3376 bytes. The problem is that every request have a 0.2
seconds delay if the amount requested is in that range (there can be other
ranges as well, but i haven’t checked those), i know that since i send
several requests to the server, as soon as the last data has arrived, I send
a new request with the same amount and so on.

What is the problem? I haven’t done anything for socket configuration except
“setsockopt(myClient, SOL_SOCKET, SO_REUSEPORT, &sockopt_val,
sockopt_size)”, is there somthing else that should be done?

I have also tried the same code in Windows (both the server and client), and
they work fine. Also if i setup the server on Windows and the client on QNX,
it works fine as well. The problem is only when the server is on the QNX
side.

Does anyone know what the problem can be?

Thanks,
Antoine.

Antoine

Antoine Haddad wrote:

The problem araises when the client askes an amount between 101 and 208
bytes or over 3376 bytes. The problem is that every request have a 0.2
seconds delay if the amount requested is in that range (there can be other
ranges as well, but i haven’t checked those), i know that since i send
several requests to the server, as soon as the last data has arrived, I send
a new request with the same amount and so on.

TCP uses a mechanism called the Nagel alogorith to group multiple
small transmissions into single large ones. This reduces network
bandwidth usage but does exactly what you say - inserts 0.2s delays.

You can disable it with the TCP_NODELAY socket option.

regards
William Morris