C-va
C-va

Reputation: 2920

How to Identify Bandwidth rate of TCP Client

I'm sending bulk data to client from my C# server application. Different clients may have different amounts of bandwidth available. For example, some clients may be using dial-up, broadband, etc.

A low-bandwidth client will be unable to get my data quickly, which may cause blocking in my server application.

I'm retrying the send 5 times to clients, if the data is not successfully received. I need to restrict data send by my server by tracking the bandwidth rate of clients.

How can I determine the bandwidth rate of receiving client in C# ?

Upvotes: 1

Views: 1193

Answers (1)

Ben Voigt
Ben Voigt

Reputation: 283911

That's not a very good approach, since bandwidth to any particular client can change dramatically.

Instead, implement some flow control (TCP provides this for you). Probably the only thing you need to do is configure your socket for non-blocking I/O, so it gives an error message when the transmit window fills instead of blocking your thread.

Upvotes: 3

Related Questions