Sample code for 30+ languages & platforms
Swift

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 Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let socket = CkoSocket()!

    //  Connect to the server using TLS.
    var bTls: Bool = true
    var maxWaitMs: Int = 5000
    success = socket.connect(hostname: "example.com", port: 5000, ssl: bTls, maxWaitMs: maxWaitMs)
    if success == false {
        print("\(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: Bool = true
    socket.resetPerf(rcvPerf: bRcvPerf)
    print("Receive-rate measurement restarted.")

}