setUpstreamBandwidth

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

setUpstreamBandwidth

ddprasad
There is a function "setUpstreamBandwidth" under
SimpleConnectionBWConfig. I have tested that it can be used control
the bandwidth between server and its client. Can it be adjusted
dynamically?

Code Extract:-
@Override
    public boolean connect(IConnection conn, IScope scope, Object[]
params) {
        String vusr = (String) params[1];
        if (LOGGING==true) log.info(PREFIX + " Connecting..." + vusr);
        BandwidthDetection detect = new BandwidthDetection(log);
        detect.checkBandwidth(conn);
                Date md1 = new Date();
        if (conn instanceof IStreamCapableConnection) {
                        IStreamCapableConnection streamConn =
(IStreamCapableConnection)
conn;
                        SimpleConnectionBWConfig bwConfig = new
SimpleConnectionBWConfig();
                        bwConfig.getChannelBandwidth()
[IBandwidthConfigure.OVERALL_CHANNEL]
= 1024 * 1024;
                        bwConfig.getChannelInitialBurst()
[IBandwidthConfigure.OVERALL_CHANNEL] = 128 * 1024;
                        if (LOGGING==true) log.info(PREFIX + "
setUpstreamBandwidth...DEFAULT:" + bwConfig.getDownstreamBandwidth
() );
                        bwConfig.setUpstreamBandwidth((1024*1024)/16);
                        if (LOGGING==true) log.info(PREFIX + "
setUpstreamBandwidth...NEW:"
+ bwConfig.getDownstreamBandwidth() );
                        streamConn.setBandwidthConfigure(bwConfig);

                }
        return super.connect(conn, scope, params);
    }

Thanking You!

D Durga Prasad