Sample code for 30+ languages & platforms
Java

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).

Chilkat Java Downloads

Java
import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    boolean success = false;

    CkSocket socket = new CkSocket();

    //  Connect to the server using TLS.
    boolean bTls = true;
    int maxWaitMs = 5000;
    success = socket.Connect("example.com",5000,bTls,maxWaitMs);
    if (success == false) {
        System.out.println(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).
    boolean bRcvPerf = true;
    socket.ResetPerf(bRcvPerf);
    System.out.println("Receive-rate measurement restarted.");
  }
}