Re: Bandwidth Allocation



salman wrote:
I am developing a server and I want to view and change the the clients
TCP connection bandwidth.

It's not really clear from your question what you want to do. However, assuming you want to do the possible rather than the impossible, the basic idea is simple:

* Displaying bandwidth requires that you count how many bytes have been transferred over a certain amount of time. How exactly to calculate this depends on what you want to display to the user. If you want to display total cumulative bandwidth, you'll just note the starting time for a transfer, count total bytes, and calculate the current bandwidth based on the ratio of the two.

If you want some sort of trailing average, you'll have to decide how often to update the average and for how many of those intervals back you want to calculate the average. One technique would be to keep a list of the byte count for each interval so that you can subtract the oldest byte count at each interval (the time part will be constant, based on the interval length and number).

Alternatively, you can do some sort of weighted average, in which all of your bytes are counted, but the most recent ones are weighted more heavily; this would allow you to calculate the trailing average without keeping track of all of the byte counts for some fixed number of intervals.

* Changing the bandwidth is a little more complicated, but not much. Obviously you can only restrict bandwidth; if the user wants more bandwidth than their network will support, you can't provide that.

For restricting bandwidth, you'll simply calculate a maximum number of bytes to transfer in some period of time, and when you reach that limit, wait until the period of time has expired. The period of time should be long enough that you can still send a reasonable amount of data in each "burst", but short enough that the network transfer is reasonably smooth.

The basic idea here is that if you have some requirement to not send data faster than, say, 100K per second then you include logic in your code that counts bytes sent and only allows 100K to go through for any one second interval (or 50K in a half second interval, or 200K in a two second interval, etc.).

Pete
.



Relevant Pages

  • Re: Who is working with the SAM9263?
    ... just to move windows, or handle overlapping windows. ... hardware to manage a display in a handheld device. ... so you can have pretty large screens without affecting the CPU ... you have up to 800 MB/s bandwidth to the memory. ...
    (comp.arch.embedded)
  • Re: AppleColor Composite Monitors discussion
    ... bandwidth luminance channel that goes into high bandwidth mode when in ... that in Apple II 40 col text and HGR, the "dot clock" was 7mhz.. ... the scope gets hooked up to the video out and the ... The easiest way to proceed is to display a pattern/color on the screen ...
    (comp.sys.apple2)
  • Re: Anti flicker filter
    ... removing flicker on NTSC TV ... Now this was done, simply to save bandwidth. ... Sending the full frame every ... These sets then need a display with twice the ...
    (sci.image.processing)
  • Re: flickering screen with Intel PSM
    ... The display subsystem on the ... Modify display configuration so that it requires less cpu bandwidth. ... Check other devices that access the system bus and ensure their timings ... Whenever the system access the NOR flash, the screen will flicker. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Creating an image - speed issues
    ... will send the entire image file to the browser and display the behavior ... you are experiencing. ... It also unnecessarily inflates the bandwidth ...
    (comp.lang.php)