views:

289

answers:

1

Hi there,

I am playing around with linux network programming and I wrote a little client server app which bounces a small message between a client and a server process and measures the round trip time. Consistently I see around 80ms for localhost round trip (this is after connection setup). This seems extraordinarily high. The same machine running the same code will clock substantially below 1ms on Vista.

Any ideas on where this difference could come from? The code is pretty straightforward, accept on one end, connect on the other and then just send/receive through the peer socket.

I am just begining on Linux, apologies if this is a silly question.

+4  A: 

If you are using TCP sockets, then you might want to disable the Nagle algorithm (by setting the TCP_NODELAY socket option).

cmeerw
This is almost certainly the issue. TCP is waiting a little while to see if you're going to give it any more data before sending the packet (if you did, it could bundle it up into one packet).
caf
You guys are right on the money. Nagle has bitten me before but somehow I forgot. Thanks a lot!
samwise