Click or drag to resize

ThrottlingListener Class

Listener that throttles bandwidth usage.
Inheritance Hierarchy

Namespace:  FastProxy.Listeners
Assembly:  FastProxy (in FastProxy.dll) Version: 0.2.0.0
Syntax
C#
public class ThrottlingListener : DelegatingListener

The ThrottlingListener type exposes the following members.

Constructors
  NameDescription
Public methodThrottlingListener(IListener, Int64)
Initializes a new ThrottlingListener.
Public methodThrottlingListener(IListener, Int64, Int64)
Initializes a new ThrottlingListener.
Public methodThrottlingListener(IListener, Int64, Int64, Int32)
Initializes a new ThrottlingListener.
Top
Methods
  NameDescription
Public methodClosed
Called when the connection has been closed.
(Inherited from DelegatingListener.)
Public methodDataReceived
Called when bytes have been received from either the server or the client.
(Overrides DelegatingListenerDataReceived(Int32, Direction).)
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from DelegatingListener.)
Protected methodDispose(Boolean)
Called when the object is being disposed.
(Overrides DelegatingListenerDispose(Boolean).)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks

This listener throttles the bandwidth of connections. This is done by delaying forwarding data for a little while if the budget for an interval is exceeded.

The slices parameter to the constructor specifies the number of time interval used to throttle connections. The default value for this parameter is 10. This means that the transfer budget is decided for every 100ms. If in that interval a connection exceeds its allotted budget, this data transfer and all following ones are delayed until a timer configured for the same interval fires.

This listener implements a best effort algorithm to throttle bandwidth usage. It's not exact, and not meant to be. The primary use case is for use in (load) testing applications to e.g. simulate a bad internet connection.

See Also