FluorineFx.NET

Bandwidth Detection

FluorineFx includes built-in support for bandwidth detection.

Initiate bandwidth detection from the server

The following sever-side code initiates bandwidth detection from the server:

public override bool AppConnect(IConnection connection, object[] parameters)
{
   CalculateClientBw();
   return base.AppConnect(connection, parameters);
}

The client must contain the following ActionScript code for the bandwidth detection

var nc:NetConnection = new NetConnection();

nc.onBWDone = function(kbitDown, deltaDown, deltaTime, latency) {
   trace(kbitDown);
   // close the Netconnection to bwcheck
   this.close();
}

nc.onBWCheck = function() {
   return ++counter; // return the call count
}

nc.connect("rtmp://localhost:1935/BWCheck");

Client initiated bandwidth detection

In a client initiated bandwidth detection it is client's responsibility to perform a CalculateClientBw() RPC.

var nc:NetConnection = new NetConnection();

nc.onBWDone = function(kbitDown, deltaDown, deltaTime, latency) {
   trace(kbitDown);
   // close the Netconnection to bwcheck
   this.close();
}

nc.onBWCheck = function() {
   return ++counter; // return the call count
}

nc.connect("rtmp://localhost:1935/BWCheck");
nc.call( "CalculateClientBw", null );