C# Class Squishy.Network.Throttle

A Throttle limits the download and/or upload speed of all its Connections to given values. The Throttle will adjust the buffersize of the Connection'str read- and write-buffer, according to the given speed limits. When throttling is discontinued the Throttle will reset the buffersizes to its default values: Connection.DefaultReceiveBufferSize and Connection.DefaultReceiveSendSize
Datei anzeigen Open project: jaddie/WCell-Utility-Bot Class Usage Examples

Public Methods

Method Description
Add ( Connection con ) : void

Adds a new connection to this throttle.

Remove ( Connection con ) : void

Removes an existent Connection from this throttle or does nothing if the connection does not belong to this throttle.

Remove ( int index ) : void
RemoveAll ( ) : void

Removes all connections from this throttle.

Throttle ( ThrottleType type ) : System
this ( int index ) : Connection

Private Methods

Method Description
AdjustReceiveBuffer ( ) : void
AdjustSendBuffer ( ) : void
CalculateBufferSize ( int maxSpeed ) : int
Poll ( ) : void
ResetReceiveBuffer ( ) : void
ResetReceiveBuffer ( Connection con ) : void
ResetSendBuffer ( ) : void
ResetSendBuffer ( Connection con ) : void
UpdateDownload ( int newBytes ) : void
UpdateUpload ( int newBytes ) : void

Method Details

Add() public method

Adds a new connection to this throttle.
public Add ( Connection con ) : void
con Connection
return void

Remove() public method

Removes an existent Connection from this throttle or does nothing if the connection does not belong to this throttle.
public Remove ( Connection con ) : void
con Connection
return void

Remove() public method

public Remove ( int index ) : void
index int
return void

RemoveAll() public method

Removes all connections from this throttle.
public RemoveAll ( ) : void
return void

Throttle() public method

public Throttle ( ThrottleType type ) : System
type ThrottleType
return System

this() public method

public this ( int index ) : Connection
index int
return Connection