Sample code for 30+ languages & platforms
Lua

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

Lua
local chilkat = require("chilkat")

local socket = chilkat.Socket.new()

-- Connect to the server using TLS.
local bTls = true
local maxWaitMs = 5000
local success = socket:connect("example.com", 5000, bTls, maxWaitMs)
if not success then
    print(socket.last_error_text)
    return
end

-- Restart one direction of transfer-rate measurement.  Pass true to reset the receive measurement
-- (RcvBytesPerSec) or false to reset the send measurement (SendBytesPerSec).
local bRcvPerf = true
socket:reset_perf(bRcvPerf)
print("Receive-rate measurement restarted.")