Bill
Bill

Reputation: 11

Getting constant delay between TCP Socket data send C#

I have a Client-Server application in C# 2010. In TCP Socket i setup Nodelay = True, and SendBufferSize = 0 for all the connected socket (client-Server) in my application.

I am tracing every incoming-outgoing packets and writing that in logfile using streamwriter, which has autoflush property set true.

I noticed 1 thing that sometimes there is a constant delay (15-16ms) between 2 data packets while sending data. after few continuous sending this delay appears again.

Why this delay? and how can i avoid it....

See the images...

http://s4.postimg.org/uoly38shp/Trace_1.png
http://s14.postimg.org/m4ab7oght/Trace_2.png

Upvotes: 1

Views: 1340

Answers (1)

MarcF
MarcF

Reputation: 3299

If you are using DateTime to track your performance 15ms is about the provided resolution. Try using Stopwatch which is more reliable.

Upvotes: 1

Related Questions