Search code examples
.nettcptcpclienttcplistenertcpsocket

Is 200 - 400 milliseconds "slow" TCP Latency ? (Not Ping)


I'm working on a networking library for my .net application and right now I'm trying to test "real world" latency.

So currently I'm sending the time from the server to the client and recording what time that message is passed up to the rest of the application.

Over what I think is a fairly nice internet connection (40/40 and 50/10) it takes right around 400 milliseconds. I don't really need it to be super fast or anything. I'm just wondering where that compares.

  • I'm not talking about ping speed, I'm talking the time starting on the server when the application calls the "send" method in my library to the time the client raises the "receive" event

Solution

  • TCP sending has two latency components:

    1. The network. Find out using ping google.com -t.
    2. Nagling. This is used to buffer writes until a packet is full or until 200ms have passed. Your case sounds like nagling. Maybe both sides nagle causing the combined delay to be 400ms plus network.

    You probably should disable nagling and optimize your Write calls so that they write all data at once. Otherwise, you'd be sending many small packets without nagling.