Sample code for 30+ languages & platforms
JavaScript

Restart Transfer-Rate Measurement

See more Socket/SSL/TLS Examples

Demonstrates Socket.ResetPerf, which restarts one direction of connection-level transfer-rate measurement.

Background. Pass true to reset the receive measurement (RcvBytesPerSec) or false to reset the send measurement (SendBytesPerSec).
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat v11.4.0 or greater.
JavaScript
var success = false;

var socket = new CkSocket();

//  Connect to the server using TLS.
var bTls = true;
var maxWaitMs = 5000;
success = socket.Connect("example.com",5000,bTls,maxWaitMs);
if (success == false) {
    console.log(socket.LastErrorText);
    return;
}

//  Restart one direction of transfer-rate measurement.  Pass true to reset the receive measurement
//  (RcvBytesPerSec) or false to reset the send measurement (SendBytesPerSec).
var bRcvPerf = true;
socket.ResetPerf(bRcvPerf);
console.log("Receive-rate measurement restarted.");